Solved

I've got following SQL syntax error: INSERT INTO

Posted on 2001-08-16
9
259 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +3
9 Comments
 
LVL 5

Expert Comment

by:raizon
ID: 6394574
Remove the ; at the end of the statment.
0
 
LVL 5

Expert Comment

by:raizon
ID: 6394578
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
ID: 6395702
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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

Expert Comment

by:andyleece
ID: 6395828
i think you should try what raizon proposed.
0
 
LVL 7

Accepted Solution

by:
weesiong earned 250 total points
ID: 6395831
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
ID: 6395951
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
ID: 6395976
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
ID: 6396221
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
ID: 6396228
Thanx very much
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

734 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