Solved

I've got following SQL syntax error: INSERT INTO

Posted on 2001-08-16
9
262 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
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!

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
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…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

635 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