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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting form data to database - ERRORS!

Status
Not open for further replies.

xWastedMindx

Technical User
Sep 3, 2002
67
US
I have a signup asp form. I have another connection asp page with an SQL query and INSERT INTO statement to try to put the form data into a database. I believe I have everything correct, but I keep getting this error below:
Is there something missing?? Or the syntax wrong?
Thanks in advance. Code is below the error...
NOTE: The SQLstring and the VALUES are one long line, might have to copy/paste into a text tile to see it correctly.


Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.

============ code ========
<%

Set Con = Server.CreateObject( &quot;ADODB.Connection&quot; )
Con.Open &quot;accessDSN&quot;

sqlString = &quot;INSERT INTO CustomerInfo( customerUserName, customerPassword, verifyPassword, customerEmail, customerFirstName, customerLastName, customerState, customerCity, customerAge, customerZip, customerGender, customerDOB, customerOffers )&quot; &_
&quot;values ( '&quot; & username & &quot;', '&quot; & password & &quot;', '&quot; & customerPassword2 & &quot;', '&quot; & emailaddy & &quot;', '&quot; & FirstName & &quot;', '&quot; & LastName & &quot;', '&quot; & State & &quot;', '&quot; & City & &quot;', &quot; & Age & &quot;, &quot; & zip & &quot;, '&quot; & Gender & &quot;', &quot; & customerDOB & &quot;, '&quot; & customerOffers & &quot;' )&quot;
Con.Execute sqlString
Con.Close

%>

It's time to kick ass and chew bubblegum, but I'm all out of gum --Duke Nukem
 
If customerDOB is a date type than you need to put #'s around the value you are inserting:

sqlString = &quot;INSERT INTO CustomerInfo( customerUserName, customerPassword, verifyPassword, customerEmail, customerFirstName, customerLastName, customerState, customerCity, customerAge, customerZip, customerGender, customerDOB, customerOffers ) &quot; &_
&quot;values ( '&quot; & username & &quot;', '&quot; & password & &quot;', '&quot; & customerPassword2 & &quot;', '&quot; & emailaddy & &quot;', '&quot; & FirstName & &quot;', '&quot; & LastName & &quot;', '&quot; & State & &quot;', '&quot; & City & &quot;', &quot; & Age & &quot;, &quot; & zip & &quot;, '&quot; & Gender & &quot;', #&quot; & customerDOB & &quot;#, '&quot; & customerOffers & &quot;' )&quot;

You could also try commenting out the execute and response.write'ing the string to the browser and than pasting it inton access, that may clue you into to any other problems you may have in it.

-Tarwn &quot;If you eat a live toad first thing in the morning, nothing worse will happen all day long.&quot; - California saying
&quot;To you or the toad&quot; - Niven's restatement of California saying
&quot;-well most of the time anyway...&quot; - programmers caveat to Niven's restatement of California saying
(The Wiz Biz - Ri
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top