daTrial.DeleteCommand = New SqlCommand
daTrial.DeleteCommand.CommandType = CommandType.StoredProcedure
daTrial.DeleteCommand.CommandText = "PKA_InsertPacking"
daTrial.DeleteCommand.Connection = conMain
daTrial.DeleteCommand.Parameters.Add("@EmpID", SqlDbType.VarChar, 3).Value = EmpID
daTrial.DeleteCommand.Parameters.Add("@WorkDate", SqlDbType.DateTime, 8).Value = TDBDate.Value
daTrial.DeleteCommand.Parameters.Add("@Item", SqlDbType.VarChar, 35, "Item")
daTrial.InsertCommand = New SqlCommand
daTrial.InsertCommand.CommandType = CommandType.StoredProcedure
daTrial.InsertCommand.CommandText = "PKA_InsertPacking"
daTrial.InsertCommand.Connection = conMain
daTrial.InsertCommand.Parameters.Add("@EmpID", SqlDbType.VarChar, 3).Value = EmpID
daTrial.InsertCommand.Parameters.Add("@WorkDate", SqlDbType.DateTime, 8).Value = TDBDate.Value
daTrial.InsertCommand.Parameters.Add("@Item", SqlDbType.VarChar, 35, "Item") '.Value = dsRow.Item(0)
daTrial.InsertCommand.Parameters.Add("@TimeEach", SqlDbType.Int, 4, "TimeEach") '.Value = dsRow.Item(2)
daTrial.InsertCommand.Parameters.Add("@QtyPacked", SqlDbType.Int, 4, "QtyPacked") '.Value = dsRow.Item(3)
daTrial.UpdateCommand = New SqlCommand
daTrial.UpdateCommand.CommandType = CommandType.StoredProcedure
daTrial.UpdateCommand.CommandText = "PKA_InsertPacking"
daTrial.UpdateCommand.Connection = conMain
daTrial.UpdateCommand.Parameters.Add("@EmpID", SqlDbType.VarChar, 3).Value = EmpID
daTrial.UpdateCommand.Parameters.Add("@WorkDate", SqlDbType.DateTime, 8).Value = TDBDate.Value
daTrial.UpdateCommand.Parameters.Add("@Item", SqlDbType.VarChar, 35, "Item")
daTrial.UpdateCommand.Parameters.Add("@TimeEach", SqlDbType.Int, 4, "TimeEach")
daTrial.UpdateCommand.Parameters.Add("@QtyPacked", SqlDbType.Int, 4, "QtyPacked")
dsTrial.GetChanges()
If dsTrial.HasChanges Then
Try
daTrial.Update(dsTrial, "Trial")
Catch ex As Exception
dsTrial.RejectChanges()
MessageBox.Show(ex.Message & ex.HelpLink) '& "Rejected Changes")
End Try
End If
dsTrial.AcceptChanges()
this is how i handle this issue. Sometimes i get a few insert issues but at least you can see my theory on how i hook up stored procedures via the data adapter.
I'm not totally sure if you mean your inserting into 3 tables, but i know that part deals with you sql. Sorry if this doesn't help. But the da.update should execute whatever procedures are hooked up to that specific data adapter.
Sincerely,
Michael