Jav,
I am now getting a different error. I was wondering if you could help me
with this one?
A first chance exception of type 'System.Data.SqlClient.SqlException'
occurred in system.data.dll
Additional information: System error.
I get it in both the UpdateSub and the Insert Sub?
I get it on the ExecuteNonQuery???
I appreciate your help.
Private Sub updateJobLoss()
Dim cmdUpdate As New SqlCommand
cmdUpdate.Connection = SqlConnection1()
cmdUpdate.CommandType = CommandType.Text
cmdUpdate.CommandText = "UPDATE JobAccident SET JobNumber = ?,
AmountofLoss = ? DateofAccident = ? ,RepairType = ?, Employee = ?,
DateofReport = ?, ReportedBy = ?, InspectionRequired = ?, BackCharge = ?,
Description = ?, AttachmentPath = ? WHERE JobAccident_ID = ?"
Dim p1 As New SqlParameter("JobNumber", Data.SqlDbType.NVarChar,
250, "JobNumber")
Dim p2 As New SqlParameter("LossAmount", Data.SqlDbType.Decimal)
Dim p3 As New SqlParameter("DateofAccident",
Data.SqlDbType.NVarChar, 50, "DateofAccident")
Dim p4 As New SqlParameter("RepairType", Data.SqlDbType.NVarChar,
50, "RepairType")
Dim p5 As New SqlParameter("Employee", Data.SqlDbType.NVarChar, 50,
"Employee")
Dim p6 As New SqlParameter("DateofReport", Data.SqlDbType.NVarChar,
50, "DateofReport")
Dim p7 As New SqlParameter("ReportedBy", Data.SqlDbType.NVarChar,
50, "ReportedBy")
Dim p8 As New SqlParameter("InspectionRequired", Data.SqlDbType.Bit)
Dim p9 As New SqlParameter("BackCharge", Data.SqlDbType.Bit)
Dim p10 As New SqlParameter("Description", Data.SqlDbType.NVarChar,
250, "Description")
Dim p11 As New SqlParameter("AttachmentPath",
Data.SqlDbType.NVarChar, 50, "AttachmentPath")
p1.Value = m_JobNumber
p2.Value = m_LossAmount
p3.Value = m_DateofAccident
p4.Value = m_RepairType
p5.Value = m_Employee
p6.Value = m_DateofReport
p7.Value = m_ReportedBy
p8.Value = m_InspectionRequired
p9.Value = m_BackCharge
p10.Value = m_Description
p11.Value = m_AttachmentPath
cmdUpdate.Parameters.Add(p1)
cmdUpdate.Parameters.Add(p2)
cmdUpdate.Parameters.Add(p3)
cmdUpdate.Parameters.Add(p4)
cmdUpdate.Parameters.Add(p5)
cmdUpdate.Parameters.Add(p6)
cmdUpdate.Parameters.Add(p7)
cmdUpdate.Parameters.Add(p8)
cmdUpdate.Parameters.Add(p9)
cmdUpdate.Parameters.Add(p10)
cmdUpdate.Parameters.Add(p11)
SqlConnection1().Open()
Dim rowsAffected As Integer
rowsAffected = cmdUpdate.ExecuteNonQuery
SqlConnection1().Close()
End Sub
Private Sub insertJobLoss()
cmdInsert.Parameters("@JobNumber").Value = m_JobNumber
cmdInsert.Parameters("@AmountofLoss").Value = m_LossAmount
cmdInsert.Parameters("@DateOfAccident").Value = m_DateofAccident
cmdInsert.Parameters("@RepairType").Value = m_RepairType
cmdInsert.Parameters("@employee").Value = m_Employee
cmdInsert.Parameters("@DateofReport").Value = m_DateofReport
cmdInsert.Parameters("@ReportedBy").Value = m_ReportedBy
cmdInsert.Parameters("@InspectionRequired").Value =
m_InspectionRequired
cmdInsert.Parameters("@BackCharge").Value = m_BackCharge
cmdInsert.Parameters("@Description").Value = m_Description
cmdInsert.Parameters("@AttachmentPath").Value = m_AttachmentPath
SqlConnection1().Open()
Dim rowsAffected As Integer
rowsAffected = cmdInsert.ExecuteNonQuery
SqlConnection1().Close()
End Sub