p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
I forgot my password Register Now
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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 10th, 2004, 12:33 AM
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
__________________
Andrew Skaggs
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old June 10th, 2004, 12:38 AM
Friend of Wrox
Points: 7,647, Level: 37
Points: 7,647, Level: 37 Points: 7,647, Level: 37 Points: 7,647, Level: 37
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,477
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old June 10th, 2004, 12:56 AM
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old June 10th, 2004, 01:14 AM
Friend of Wrox
Points: 7,647, Level: 37
Points: 7,647, Level: 37 Points: 7,647, Level: 37 Points: 7,647, Level: 37
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,477
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old June 10th, 2004, 01:18 AM
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #6 (permalink)  
Old June 10th, 2004, 01:21 AM
Friend of Wrox
Points: 7,647, Level: 37
Points: 7,647, Level: 37 Points: 7,647, Level: 37 Points: 7,647, Level: 37
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,477
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Great!

Good night then. Have a sound sleep;)

_________________________
-Vijay G
Strive for Perfection
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

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 Stephan BOOK: Beginning JavaScript 16 February 22nd, 2005 01:43 PM
Syntax error in INSERT INTO statement mega ASP.NET 1.0 and 1.1 Basics 3 January 12th, 2005 04:30 PM
Syntax error in INSERT INTO statement evol77 ASP.NET 1.1 2 December 17th, 2004 06:15 AM
Syntax error in INSERT INTO statement sankar ASP.NET 1.1 9 May 20th, 2004 03:48 PM



All times are GMT -4. The time now is 08:08 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc