ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old January 29th, 2000, 09:26 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,578 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
SQL INSERT INTO and Numbers

<i><b>Originally posted by : Mike Horton (mhorton@planet.eon.net)</b></i><br />I posted this question last night and it looks like I did it a day too soon <G> so here goes again.<br /><br />I'm using a form to get information to insert into a database. I know from using Response.Write that the information passed is correct but I keep getting the following error: Syntax error in INSERT INTO statement.<br /><br />Here's my INSERT code:<br />SQLstmt = "INSERT INTO Drivers (First Name,Last Name,Country,Helmet)"<br />SQLstmt = SQLstmt & " VALUES (" <br />SQLstmt = SQLstmt & "'" & First_Name & "',"<br />SQLstmt = SQLstmt & "'" & Last_Name & "',"<br />SQLstmt = SQLstmt & "'" & Country & "',"<br />SQLstmt = SQLstmt & "'" & Helmet & "'"<br />SQLstmt = SQLstmt & ")"<br /><br />Now Country and Helmet are numbers (I've got them tied into relationships). I've used this exact same code when all the fields were text and it worked great. I've also seen where you use a # around a date so I've tried that with now success. Any help would be greatly appreciatted.<br />BTW There's also a Yes/No field in the table. Does that have to be filled and will a simple ' No ' do the trick?<br /><br />Thanks

Reply With Quote
  #2  
Old January 29th, 2000, 09:38 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,578 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
<i><b>Originally posted by : Steve Schofield (sschofield@aspfree.com)</b></i><br />Sorry about blowing your question away! when inserting numbers you don't need single quotes around it. when inserting into a bit field its either a 1 or 0. <br /><br />steve<br /><br /><br />------------<br />Mike Horton at 1/29/00 7:26:44 PM<br /><br />I posted this question last night and it looks like I did it a day too soon <G> so here goes again.<br /><br />I'm using a form to get information to insert into a database. I know from using Response.Write that the information passed is correct but I keep getting the following error: Syntax error in INSERT INTO statement.<br /><br />Here's my INSERT code:<br />SQLstmt = "INSERT INTO Drivers (First Name,Last Name,Country,Helmet)"<br />SQLstmt = SQLstmt & " VALUES (" <br />SQLstmt = SQLstmt & "'" & First_Name & "',"<br />SQLstmt = SQLstmt & "'" & Last_Name & "',"<br />SQLstmt = SQLstmt & "'" & Country & "',"<br />SQLstmt = SQLstmt & "'" & Helmet & "'"<br />SQLstmt = SQLstmt & ")"<br /><br />Now Country and Helmet are numbers (I've got them tied into relationships). I've used this exact same code when all the fields were text and it worked great. I've also seen where you use a # around a date so I've tried that with now success. Any help would be greatly appreciatted.<br />BTW There's also a Yes/No field in the table. Does that have to be filled and will a simple ' No ' do the trick?<br /><br />Thanks

Reply With Quote
  #3  
Old January 30th, 2000, 12:08 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,578 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
<i><b>Originally posted by : Mike Horton (mhorton@planet.eon.net)</b></i><br /><br />Thanks Steve. No problem on blowing the question away. I tried what you mentioned and it was still giving me the error. It wasn't until I took the space out of the field names (First Name) that I was able to get it working.<br /><br />Thanks again<br />Mike<br /><br />------------<br />Steve Schofield at 1/29/00 7:38:55 PM<br /><br />Sorry about blowing your question away! when inserting numbers you don't need single quotes around it. when inserting into a bit field its either a 1 or 0. <br /><br />steve<br /><br /><br />------------<br />Mike Horton at 1/29/00 7:26:44 PM<br /><br />I posted this question last night and it looks like I did it a day too soon <G> so here goes again.<br /><br />I'm using a form to get information to insert into a database. I know from using Response.Write that the information passed is correct but I keep getting the following error: Syntax error in INSERT INTO statement.<br /><br />Here's my INSERT code:<br />SQLstmt = "INSERT INTO Drivers (First Name,Last Name,Country,Helmet)"<br />SQLstmt = SQLstmt & " VALUES (" <br />SQLstmt = SQLstmt & "'" & First_Name & "',"<br />SQLstmt = SQLstmt & "'" & Last_Name & "',"<br />SQLstmt = SQLstmt & "'" & Country & "',"<br />SQLstmt = SQLstmt & "'" & Helmet & "'"<br />SQLstmt = SQLstmt & ")"<br /><br />Now Country and Helmet are numbers (I've got them tied into relationships). I've used this exact same code when all the fields were text and it worked great. I've also seen where you use a # around a date so I've tried that with now success. Any help would be greatly appreciatted.<br />BTW There's also a Yes/No field in the table. Does that have to be filled and will a simple ' No ' do the trick?<br /><br />Thanks

Reply With Quote
  #4  
Old January 31st, 2000, 09:27 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,578 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
<i><b>Originally posted by : steve schofield</b></i><br />Thanks for taking time to post the answer! I believe these forums will definately better than what we used in the past!<br /><br />steve<br /><br /><br />------------<br />Mike Horton at 1/29/00 10:08:50 PM<br /><br /><br />Thanks Steve. No problem on blowing the question away. I tried what you mentioned and it was still giving me the error. It wasn't until I took the space out of the field names (First Name) that I was able to get it working.<br /><br />Thanks again<br />Mike<br /><br />------------<br />Steve Schofield at 1/29/00 7:38:55 PM<br /><br />Sorry about blowing your question away! when inserting numbers you don't need single quotes around it. when inserting into a bit field its either a 1 or 0. <br /><br />steve<br /><br /><br />------------<br />Mike Horton at 1/29/00 7:26:44 PM<br /><br />I posted this question last night and it looks like I did it a day too soon <G> so here goes again.<br /><br />I'm using a form to get information to insert into a database. I know from using Response.Write that the information passed is correct but I keep getting the following error: Syntax error in INSERT INTO statement.<br /><br />Here's my INSERT code:<br />SQLstmt = "INSERT INTO Drivers (First Name,Last Name,Country,Helmet)"<br />SQLstmt = SQLstmt & " VALUES (" <br />SQLstmt = SQLstmt & "'" & First_Name & "',"<br />SQLstmt = SQLstmt & "'" & Last_Name & "',"<br />SQLstmt = SQLstmt & "'" & Country & "',"<br />SQLstmt = SQLstmt & "'" & Helmet & "'"<br />SQLstmt = SQLstmt & ")"<br /><br />Now Country and Helmet are numbers (I've got them tied into relationships). I've used this exact same code when all the fields were text and it worked great. I've also seen where you use a # around a date so I've tried that with now success. Any help would be greatly appreciatted.<br />BTW There's also a Yes/No field in the table. Does that have to be filled and will a simple ' No ' do the trick?<br /><br />Thanks

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingASP Development > SQL INSERT INTO and Numbers


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway