Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted
Why do you suggest using the querystring instead of the request.form? From what I understand you can use either depending on which HTTP method used to submit the data. Request.Form requires POST while the querystring requires GET. In your experience is one better than the other?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...