Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 10th, 2004, 12:33 AM
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
Reply With Quote
  #2 (permalink)  
Old June 10th, 2004, 12:38 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 0 Times in 0 Posts
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
Reply With Quote
  #3 (permalink)  
Old June 10th, 2004, 12:56 AM
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
Reply With Quote
  #4 (permalink)  
Old June 10th, 2004, 01:14 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 0 Times in 0 Posts
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
Reply With Quote
  #5 (permalink)  
Old June 10th, 2004, 01: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
Reply With Quote
  #6 (permalink)  
Old June 10th, 2004, 01:21 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Great!

Good night then. Have a sound sleep;)

_________________________
-Vijay G
Strive for Perfection
Reply With Quote
Reply


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

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

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 05:01 PM
Syntax error in INSERT INTO statement mega ASP.NET 1.0 and 1.1 Basics 3 January 12th, 2005 04:30 PM



All times are GMT -4. The time now is 10:15 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.