It shows that you are unregistered. Please register with us by clicking Here
![]() |
|
![]() |
![]() | Register - FAQ - Today's Posts - New Posts - Support - Search | ![]() |
|
|
#1 (permalink) |
|
Junior Member
Join Date: Jul 2006
Age: 48
Posts: 7
|
<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 Ashley |
|
|
|
|
|
|
|
#2 (permalink) |
|
Junior Member
Join Date: Jul 2006
Age: 39
Posts: 8
|
Hi,
Pls make sure that you remove quotes (') before and after the numeric field. I think you are having problem because the numeric fields contain quotes. Also if the yes/No field is mandatory then only you need to includ them in the SQL query else you can leave it. |
|
|
|
|
|
#3 (permalink) |
|
Junior Member
Join Date: Jul 2006
Age: 48
Posts: 25
|
The basic syntax for INSERT is
INSERT INTO <table name> [(column name1, column name2,..) VALUES (Value1, Value2,...)] <SELECT statement> Looking at your statement it seams to be ok but I thing the numerical values shoud not have (') i think you need them for text only, try removing them from any numerical values and try again |
|
|
|
|
|
#4 (permalink) |
|
Senior Member
Join Date: Jul 2006
Age: 30
Posts: 258
|
here you can find the basic syntax for insert (in MySQL):
http://dev.mysql.com/doc/refman/5.0/en/insert.html
__________________
-- iM |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Adding numbers | sebastian | JavaScript | 3 | 10-12-2006 03:02 AM |
| Insert lines to the beginning of a file | logan | Perl | 0 | 07-27-2006 06:04 PM |
| American Express Numbers | claire | General Business Issues | 1 | 07-12-2006 05:00 AM |
| Insert and update the same time | alejandro | ASP | 1 | 07-06-2006 01:13 PM |
| Adding numbers | miguel | ASP | 0 | 07-02-2006 08:08 AM |