how to disable SQL Table trigger to insert a row

  • Thread starter Thread starter MarkSLaRosa
  • Start date Start date
M

MarkSLaRosa

Guest
I am new to vb.net and am trying to insert a row to a table and am running into a trigger throwing a "specified cast is not valid vb.net" error and I am assuming it's the trigger stopping the insert command from completing. My data is correct, I have validated it manually and believe if I stop the trigger I can force the entry. of course I am in a test DB to do this. I just do not know nor can I find help online to complete the code. Please forgive the amateur coding.

HT16DataSet.EnforceConstraints = False

HT16DataSet.INVENTORY_TRANSDataTable ---- Here's where I think I need to disable the trigger.

Me.INVENTORY_TRANSTableAdapter.FillByMaxID(HT16DataSet.INVENTORY_TRANS)

nextID = HT16DataSet.INVENTORY_TRANS.Rows(0)("TRANSACTION_ID") + 1

Me.HT16DataSet.INVENTORY_TRANS.Clear()

Try
'Me.INVENTORY_TRANSTableAdapter.InsertQuery(nextID, PO, PO_Line, PartNo, Type, ClassR, CDec(Shipped), 0, datetouse, Whse, Loc, NLstr, NLstr, Post, (CDec(Shipped) * CDec(matl_cost)), (CDec(Shipped) * CDec(labor_cost)), (CDec(Shipped) * CDec(bur_cost)), (CDec(Shipped) * CDec(ser_cost)), datetouse, CC, SiteID)

Me.INVENTORY_TRANSTableAdapter.Insert(nextID, NLstr, NLstr, NLstr, NLstr, NLstr, NLint, NLint, NLstr, NLint, PO, PO_Line, PartNo, Type, ClassR, CDec(Shipped), 0, datetouse, Whse, Loc, NLstr, uname, Nfld, NLstr, (CDec(Shipped) * CDec(matl_cost)), (CDec(Shipped) * CDec(labor_cost)), (CDec(Shipped) * CDec(bur_cost)), (CDec(Shipped) * CDec(ser_cost)), datetouse, NLint, NLint, NLint, NLint, NLint, NLstr, NLint, NLstr, NLstr, NLint, NLint, NLstr, NLstr, NLstr, NLstr, NLstr, NLint, NLstr, NLstr, NLstr, NLstr, NLstr, NLstr, NLstr, NLstr, NLstr, datetouse, 1, SiteID, NLstr, NLstr, NLstr, NLstr)

Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message & " Inv Trans")
End Try

Continue reading...
 
Back
Top