Alright, I'm confused. I have an ItemMenu.aspx page that passes the value of ItemNum to my InsertItem.aspx page. Note that txtItemNum.Text is updated during the Page_Load event. I'm able to insert a new row into the "Items" table with the following SQL statement where ItemNum is hard coded;
Sub Page_Load(Src As Object, E As EventArgs)
strItemNum = Request.Form("ItemNum")
txtItemNum.Text = strItemNum
End Sub
strSQL = "INSERT INTO Item (ItemNum, Description, ItemSuppNum, Cost, Price, UnitOfMeasure, OnHand) VALUES ('6668', '" & txtDescription.Text & "', '" & txtItemSuppNum.Text & "', " & dblCost & ", " & dblPrice & ", '" & txtUnitOfMeas.Text & "', " & intOnHand & ")"
Now, when I try to use either of the variables strItemNum or txtItemNum in the following two SQL statements I get the same error;
Error => Field 'Item.ItemNum' cannot be a zero-length string
strSQL = "INSERT INTO Item (ItemNum, Description, ItemSuppNum, Cost, Price, UnitOfMeasure, OnHand) VALUES ('" & strItemNum & "', '" & txtDescription.Text & "', '" & txtItemSuppNum.Text & "', " & dblCost & ", " & dblPrice & ", '" & txtUnitOfMeas.Text & "', " & intOnHand & ")"
strSQL = "INSERT INTO Item (ItemNum, Description, ItemSuppNum, Cost, Price, UnitOfMeasure, OnHand) VALUES ('" & txtItemNum.Text & "', '" & txtDescription.Text & "', '" & txtItemSuppNum.Text & "', " & dblCost & ", " & dblPrice & ", '" & txtUnitOfMeas.Text & "', " & intOnHand & ")"
It appears I'm losing my value for some reason. Can anyone offer some advice?
Thanks
Tate
Sub Page_Load(Src As Object, E As EventArgs)
strItemNum = Request.Form("ItemNum")
txtItemNum.Text = strItemNum
End Sub
strSQL = "INSERT INTO Item (ItemNum, Description, ItemSuppNum, Cost, Price, UnitOfMeasure, OnHand) VALUES ('6668', '" & txtDescription.Text & "', '" & txtItemSuppNum.Text & "', " & dblCost & ", " & dblPrice & ", '" & txtUnitOfMeas.Text & "', " & intOnHand & ")"
Now, when I try to use either of the variables strItemNum or txtItemNum in the following two SQL statements I get the same error;
Error => Field 'Item.ItemNum' cannot be a zero-length string
strSQL = "INSERT INTO Item (ItemNum, Description, ItemSuppNum, Cost, Price, UnitOfMeasure, OnHand) VALUES ('" & strItemNum & "', '" & txtDescription.Text & "', '" & txtItemSuppNum.Text & "', " & dblCost & ", " & dblPrice & ", '" & txtUnitOfMeas.Text & "', " & intOnHand & ")"
strSQL = "INSERT INTO Item (ItemNum, Description, ItemSuppNum, Cost, Price, UnitOfMeasure, OnHand) VALUES ('" & txtItemNum.Text & "', '" & txtDescription.Text & "', '" & txtItemSuppNum.Text & "', " & dblCost & ", " & dblPrice & ", '" & txtUnitOfMeas.Text & "', " & intOnHand & ")"
It appears I'm losing my value for some reason. Can anyone offer some advice?
Thanks
Tate