Solved

I've got following SQL syntax error: INSERT INTO

Posted on 2001-08-16
9
239 Views
Last Modified: 2008-02-01
Hello,

I've got following SQL syntax error:



Microsoft JET Database Engine error '80040e14'

Syntax error in INSERT INTO statement.

/New/nl/update_inscription.asp, line 40



My code in update_inscription.asp:

<% Dim strSQLINSERT1
   Dim strSQLINSERT2
   Dim strSQLSELECT1
   Dim strLanguage
   
   strLanguage = "nl"
   response.buffer=true
 

     strSQLINSERT1="INSERT INTO PLAYER (J_NAME,EMAIL,J_PASSWORD,LANGUAGE) VALUES ('"&Session("J_NAME")&"','"&Session("EMAIL")&"','"&Session("J_PASSWORD")&"','"&strLanguage&"');"
     strSQLSELECT1="SELECT PLAYER.J_ID, PLAYER.J_NAME, PLAYER.EMAIL FROM PLAYER WHERE (((PLAYER.J_NAME='"&Session("J_NAME")&"'))OR((PLAYER.EMAIL='"&Session("EMAIL")&"')))"    
     
     strSQLINSERT2="INSERT INTO SCORE (J_ID,TOTAL_POINTS,AVERAGE,NUMBER_PARTICIPATED,BONUS) VALUES ('"&Session("J_ID")&"',0,0,0,0)"
%>

<html>

<head>
<title>New Page 1</title>
<meta name="Microsoft Border" content="tl, default">
</head>
     

<body>
<%  
     set conntemp=OpenDB()
     set rs = conntemp.Execute(strSQLSELECT1)

     if rs.EOF then
%>
<TABLE width="606" border="1" bgcolor="#FFFFFF" bordercolor="590000" cellpadding="0" cellspacing="0">
  <tr>
    <td width="596" height="446" valign="top" align="center" bordercolor=" ">
      <p>&nbsp;</p>
      <p><font face="Verdana, Arial, Helvetica, sans-serif" size="3" color="590000">Bedankt</font><font face="Verdana, Arial, Helvetica, sans-serif" size="3" color="590000">
        , <b><%=Session("J_NAME") %></b>, voor uw inschrijving !!! <br>
        <%
          response.write(strSQLINSERT1)
          conntemp.Execute(strSQLINSERT1) => here I got the syntax error
          rs.close()



the result of this code is:

Bedankt , test888, voor uw inschrijving !!!
INSERT INTO PLAYER (J_NAME,EMAIL,J_PASSWORD,LANGUAGE) VALUES ('test888','test888@ibm.net','zesdxc','nl');



Why am i having an INSERT INTO syntax error ???
0
Comment
Question by:geertrobberechts
  • 2
  • 2
  • 2
  • +3
9 Comments
 
LVL 5

Expert Comment

by:raizon
Comment Utility
Remove the ; at the end of the statment.
0
 
LVL 5

Expert Comment

by:raizon
Comment Utility
Change this

strSQLINSERT1="INSERT INTO PLAYER (J_NAME,EMAIL,J_PASSWORD,LANGUAGE) VALUES ('"&Session("J_NAME")&"','"&Session("EMAIL")&"','"&Session("J_PASSWORD")&"','"&strLanguage&"');"


To This

strSQLINSERT1="INSERT INTO PLAYER (J_NAME,EMAIL,J_PASSWORD,LANGUAGE) VALUES ('"&Session("J_NAME")&"','"&Session("EMAIL")&"','"&Session("J_PASSWORD")&"','"&strLanguage&"')"
0
 
LVL 20

Expert Comment

by:Silvers5
Comment Utility
Set blank lines before and after the ampresands (&) also check if all the sessions are populated.. try to response.write your query to see if it's correct

strSQLINSERT1="INSERT INTO PLAYER (J_NAME,EMAIL,J_PASSWORD,LANGUAGE) VALUES ('" & Session("J_NAME") & "','" & Session("EMAIL") & "','" & Session("J_PASSWORD") & "','" & strLanguage & "');"



0
 

Expert Comment

by:andyleece
Comment Utility
i think you should try what raizon proposed.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 7

Accepted Solution

by:
weesiong earned 250 total points
Comment Utility
geertrobberechts,

strSQLINSERT1="INSERT INTO PLAYER (J_NAME,EMAIL,J_PASSWORD,[LANGUAGE]) VALUES ('"&Session("J_NAME")&"','"&Session("EMAIL")&"','"&Session("J_PASSWORD")&"','"&strLanguage&"')"

Language is special [fieldname] so need using [] :)

Regards,
Wee Siong
0
 

Expert Comment

by:hi_billy
Comment Utility
try not to use your common function.....(set conntemp=OpenDB()), but it's the jet engine problem...
and change to this :

Set dbconnect = Server.CreateObject("ADODB.Connection")
conntemp.Open "your connect string"
0
 
LVL 20

Expert Comment

by:Silvers5
Comment Utility
ehh disregard my last comment.. remove the ; simply as said by other experts
hi_billy don't post you comment as an answer..
0
 

Author Comment

by:geertrobberechts
Comment Utility
Wee Siong comment is the right answer

geertrobberechts,

strSQLINSERT1="INSERT INTO PLAYER (J_NAME,EMAIL,J_PASSWORD,[LANGUAGE]) VALUES ('"&Session("J_NAME")&"','"&Session("EMAIL")&"','"&Session("J_PASSWORD")&"','"&strLanguage&"')"


Language is special [fieldname] so need using [] :)

Regards,
Wee Siong
0
 

Author Comment

by:geertrobberechts
Comment Utility
Thanx very much
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now