Solved

I've got following SQL syntax error: INSERT INTO

Posted on 2001-08-16
9
250 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: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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

803 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