Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with command's parameters

Status
Not open for further replies.

achmo

Programmer
Aug 30, 2001
56
IL
hello,

I am sending a form to an asp page, where I'm using a command object to activate an updating stored procedure on sql server. I'm filling the command's parameters using "request" on what was sent from the form.

There is one parameter that is not passed correctly. it looks like this:

Code:
cmd1.Parameters.Append cmd1.CreateParameter("productID",4,1,4,request("productID"))

on some productID's the number is not updated correctly in the database: instead of, say 56858905, I get 56858904. The problem is consistant - the same numbers are the ones updated badly and each is always updated to it's wrong number. The wrong numbers are close to the originals, but not the same - 1, 2,3 and so less or more.

The stranges thing is, I can't find where the problem is. If i display the value of the "request" used, it is the correct value. If I'm using Query Analizer to activate the stored procedure using the same number - the update is ok.

So where can the problem come from?

Hope someone can help

Yael
 
well, I still havn't found the source of the problem, but I think it has to do with the id's beeing too long. What I did is add an identity column to the database and use this column as productID instead of the long numbers.
 
You could also try placing your Request("productID") inside a cDbl() to make sure it is getting passed as a number ratherthan a string. And be careful of the variable order as well, that is apparently an issue with stored parameters sometimes. It should be the same order as the stored parameter in the db.
-Tarwn
-Tarwn ------------ My Little Dictionary ---------
Extreme Programming - (1)Trying to code before my second cup of coffee. (2) While(1){ Ctrl+C; Ctrl+V; }
FAQ - Web-ese for "Forget Asking Questions, I am to busy" :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top