Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 9th, 2004, 11:33 PM
Registered User
 
Join Date: Jun 2004
Location: Savannah, TN, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Syntax error in INSERT INTO statement.

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
/signupconf.asp, line 9

Here's the code up to the point that error occurs. (Red marks are my edits for this post)

<%
dim oConn
dim oRs
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)}"
oConn.ConnectionString = oConn.ConnectionString & ";DBQ=" & server.MapPath("login.mdb")
oConn.Open
line 9 -> set oRs = oConn.Execute("INSERT INTO tblLoginInfo(usrnm,psswrd,rlnm,eml,qstn,answr) VALUES('" & request.Form("usrnm") & "','" & request.Form("psswrd") & "','" & request.Form("rlnm") & "','" & request.Form("eml") & "','" & request.Form("qstn") & "','" & request.Form("answr") & "'")
%>

As you can see, it's pretty standard stuff...although perhaps not standard enough...stupid syntax error. I've condensed down the field names in the Access database and in my form to try and avoid any reserved words. I've also tried replacing all the request.Form statements with static values for testing purposes, but that didn't seem to work either. I've been searching forums for hours and can't seem to come up with a solution. Any ideas?

Andrew Skaggs
  #2 (permalink)  
Old June 9th, 2004, 11:38 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Andrew

Try this.

Code:
strSQL = "INSERT INTO tblLoginInfo(usrnm,psswrd,rlnm,eml,qstn,answr) VALUES('" & request.Form("usrnm") & "','" & request.Form("psswrd") & "','" & request.Form("rlnm") & "','" & request.Form("eml") & "','" & request.Form("qstn") & "','" & request.Form("answr") & "'"

response.write strSQL
response.end

'''set oRs = oConn.Execute(strSQL)
Then execute output of the above response.write in your DB directly, and see what is missing. Should be some missing QUOTE error.

Hope that helps.
Cheers!

_________________________
-Vijay G
Strive for Perfection
  #3 (permalink)  
Old June 9th, 2004, 11:56 PM
Registered User
 
Join Date: Jun 2004
Location: Savannah, TN, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, I'm getting there... I missed a parenthesis. I needed one right before the last double quotes. Now...on to the next error. :)

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.

Line 14 is the same code that was line 9 (I added your suggested debugging code above and just commented it out) with the addition of the parenthesis.

set oRs = oConn.Execute("INSERT INTO tblLoginInfo(usrnm,psswrd,rlnm,eml,qstn,answr) VALUES('" & request.Form("usrnm") & "','" & request.Form("psswrd") & "','" & request.Form("rlnm") & "','" & request.Form("eml") & "','" & request.Form("qstn") & "','" & request.Form("answr") & "')")


Thanks already for your help.

Andrew Skaggs
  #4 (permalink)  
Old June 10th, 2004, 12:14 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

The "IUSR_your_machine" has not enough permissions to write into your database. IUSR privileges must be set to "read/write".

That will solve this.

Cheers!

_________________________
-Vijay G
Strive for Perfection
  #5 (permalink)  
Old June 10th, 2004, 12:18 AM
Registered User
 
Join Date: Jun 2004
Location: Savannah, TN, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yeah, thanks a bunch! I had just figured that out and got one more issue worked out and everything seems to be working beautifully now.

*pant* Time to get some sleep...it's 12:18 AM... Man, I love programming. :)

Again, thanks a ton.

Andrew Skaggs
  #6 (permalink)  
Old June 10th, 2004, 12:21 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Great!

Good night then. Have a sound sleep;)

_________________________
-Vijay G
Strive for Perfection


Similar Threads
Thread Thread Starter Forum Replies Last Post
NEED HELP INSERT INTO statement syntax error koco ASP.NET 1.0 and 1.1 Basics 6 June 2nd, 2006 04:01 PM
Syntax error in INSERT INTO statement mega ASP.NET 1.0 and 1.1 Basics 3 January 12th, 2005 04:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.