I need to update my database. I receive the Id in a url string:
https://128bit.clickandpledge.com/Shopping/BNewUser.aspx?I=344
Where ' I ' in the url is the following: 34 would be the id of the record in the database and the last number 4 would be the number I need to subtract from the total available tickets in the database.
So here is how it goes. A user goes to the site, they want to purchase 4 tickets. They enter in 4 in the input the box and off to the payment processor. I do not collect any information on the website itself. After processing the database record ID and the purhased tickets are joined together as one number in the url. I need to parse the first two numbers and use in my where clause and the last number I need to subtract from the available field in the database.
I have no idea how to do this. I know it has to be simple. Help
tonyDim stringI as string
stringI = Request.QueryString("I")
Dim intRec as Integer
intRec = CInt(Left(I,2))
Dim intQty as Integer
intQty = CInt(Right(I,1))
You really should sit at the drawing board a little longer. What happens when you hit record number 99? What happened prior to record 10?
If you insist on using a query string then you should probably use 2 parameters. Ie.,http://www.yoursite.com?I=34&J=4
That saves you the trouble of concatenating them in the first place.
Then the code is simple
int Record = Convert.ToInt16(Request.QueryString["I"]);
int Tickets = Convert.ToInt16(Request.QueryString["J"]);
just my 2 cents.
Friday, March 16, 2012
Newbie needs quick help
Labels:
128bit,
asp,
aspxi344where,
bnewuser,
clickandpledge,
database,
net,
newbie,
receive,
shopping,
stringhttps,
update,
url
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment