WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Database Discussion Forum This is the place to find help resolving those nagging questions you have about implementing and using all kinds of databases. Need help writing a query? Need an opinion on Oracle? Post here!

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-23-2004, 04:57 AM
WebProWorld Member
 

Join Date: Feb 2004
Posts: 58
yorks RepRank 0
Default Insert query with ASP

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
Reply With Quote
  #2 (permalink)  
Old 02-23-2004, 07:50 AM
paulhiles's Avatar
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: UK
Posts: 2,803
paulhiles RepRank 0
Default

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
Reply With Quote
  #3 (permalink)  
Old 02-23-2004, 04:01 PM
swstyles's Avatar
WebProWorld Pro
 

Join Date: Aug 2003
Location: Phoenix, AZ
Posts: 167
swstyles RepRank 0
Default Re: Insert query with ASP

Quote:
Originally Posted by yorks
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.
__________________
Daniel M: South West Styles/STEELid
daniel@steelid.com
http://www.steelid.com
http://www.thephototool.com
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Tags: , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0