SunQuest
           ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old August 14th, 2003, 12:23 PM
transreflective transreflective is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 1 transreflective User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Insert Into Syntax Error

I read through your posts and also other forum about this error and I did what was said but I still get this error:

INSERT INTO feedback ([pname], [email], [comments], [outcome], [additional], [try]) VALUES (
Microsoft JET Database Engine error '80040e14'

Syntax error in INSERT INTO statement.

/room20/survey.asp, line 33

I even put everything in brackets, just to be on the safe side for reserved words.I did not do Word Wrap, so everything is on one line. Complete code is as follows:

<%
dim pname
dim email
dim comments
dim outcome
dim additional
dim answer
dim oConn
dim sConnection
dim sql

pname=Request.Form("name")
email=Request.Form("email")
comments=Request.Form("comments")
outcome=Request.Form("outcome")
additional=Request.Form("additional")
answer=Request.Form("try")

Set oConn = Server.CreateObject("ADODB.Connection")
sConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("\room20\db\survey.mdb") & ";" & _
"Persist Security Info=False"
oConn.Open(sConnection)

sql="INSERT INTO feedback ([pname], [email], [comments], [outcome], [additional], [try]) VALUES ("' & pname & '", "' & email & '", "' & comments & '", "' & outcome & '", "' & additional & '", "' & answer & '")"

response.write(sql)

oConn.Execute sql

if err<>0 then
Response.Write("<b>Sorry, due to technical difficulties your feedback has not been submitted.</b>")
else
Response.Write("<h4>Your feedback has been submitted. Thank you!</h4>")
end if

oConn.Close
%>

What might be wrong?

Thanks.

Reply With Quote
  #2  
Old August 14th, 2003, 12:30 PM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
step one would be to take it to the DB's command prompt and get it working that way? do you have access to the command prompt? Notice the error cuts of after VALUES (... that means that's all it's getting, so let's look at your asp code

Step 2 would be to use correct string concatenation
you have

(" ' & pname & ' ",

you need to use

(' " & pname & " ',

the ' is what needs to appear in the sql statement. and the " are what close the string to put in variables.

Reply With Quote
  #3  
Old August 26th, 2003, 02:10 PM
zimm zimm is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 30 zimm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Looks to me like you've got your tick marks and quote marks reversed.

should be insert ..... values (' " & somevariable & " ', ' " & somevariable & " ', ' "

Yours looks to me like
insert...values (" ' & somevariable & ' ", " ' & somevariable & ' ", ' ".....

Reply With Quote
  #4  
Old August 26th, 2003, 02:36 PM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
ALSO...
---BEGIN QUOTE---
I even put everything in brackets, just to be on the safe side for reserved words
---END QUOTE---


You know, Microsoft doesn't create reserved words every months!

So why "just to be on the safe side"?

Here...bookmark this website, it holds *all* the reserved words for Access, SQL Server and others...
http://www.aspfaq.com/show.asp?id=2080

It is *YOUR* job as a programmer to make sure NOT TO USE reserved words!

It can/will occasionally happen but not to you, not anymore anyway, since you've bookmarked the website

Hope this helps!
Sincerely

Vlince

Reply With Quote
  #5  
Old August 26th, 2003, 06:56 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,703 Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 4 Weeks 1 Day 21 h 25 m 29 sec
Reputation Power: 688
What does your response.write show for your sql statement?

Often missing or illegal form data is the culprit. I think it's a good idea to "sanitize" any user input data before using it as part of a SQL string.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Insert Into Syntax Error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway