PDA

View Full Version : Insert query with ASP



yorks
02-23-2004, 04:57 AM
Hi all

Just working on an ASP website (i am fairly new to ASP) and having a very strange problem. The code below does not work BUT if I replace the first "&UID&" field in the values list with say 9999 it works. Uid is defined as it is inserted in the second position of values list.

In the datbase userid and picid are both integers.

Query4="insert into UserPicture (UserId,PicId,Pic) values("&Uid&","&Uid&",'"&pic&"')"


any help wuld be much appreciated

Robert

paulhiles
02-23-2004, 07:50 AM
Hi Robert,

This sounds very much like a database question rather than an ASP problem. It sounds on the face of it, as though the database is expecting an integer value to be inserted there. Looking at the code, it strikes me as very strange that you're repeating the same variable in your "insert" query. I'm going to move this topic into the Database forum, where you may get a better response.

Good luck,

Paul

swstyles
02-23-2004, 04:01 PM
In the datbase userid and picid are both integers.

Query4="insert into UserPicture (UserId,PicId,Pic) values("&Uid&","&Uid&",'"&pic&"')"


looks like you need to define your datatypes.

do this
Uid = clng(Uid)

This will convert your id strings to integers.
If the value is not an integer, it will cause an error.