Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

I've got following SQL syntax error: INSERT INTO

Posted on 2001-08-16
9
Medium Priority
?
277 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
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:Michel Sakr
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Expert Comment

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

Accepted Solution

by:
weesiong earned 1000 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:Michel Sakr
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

Technology Partners: 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 have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
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 course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

971 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