Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: sytax error... please help


Message #1 by blueatmosphere@y... on Sun, 6 Oct 2002 15:02:49
why is there a sytax error in the 

conn.execute strInsertSQL ? they say it is a sytax error... 

PLEASE HELP!

<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0;Data 
Source=C:\Inetpub\wwwroot\023291A-web-\db7.mdb;Persist Security Info=False"
strDB = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="
conn.Open(Server.MapPath("db7.mdb"))

strInsertSQL = "INSERT INTO Customer (firstname,myemail,passwrd,number) 
VALUES "
strInsertSQL = strInsertSQL 
& "('"&firstname&"'','"&myemail&"','"&passwrd&"',"&number&")"

conn.execute strInsertSQL
conn.close
%>    
Message #2 by "Gerhard Wentink" <gerhard@d...> on Sun, 6 Oct 2002 16:08:06 +0200
After the variable firstname you have two quotes (&firstame &'',')
Must be: & firstname &','

Regards,

Gerhard Wentink

>-----Original Message-----
>From: blueatmosphere@y... [mailto:blueatmosphere@y...] 
>Sent: Sunday, October 06, 2002 3:03 PM
>To: ASP Databases
>Subject: [asp_databases] sytax error... please help
>
>
>why is there a sytax error in the 
>
>conn.execute strInsertSQL ? they say it is a sytax error... 
>
>PLEASE HELP!
>
><%
>set conn=Server.CreateObject("ADODB.Connection")
>conn.Provider="Microsoft.Jet.OLEDB.4.0;Data 
>Source=C:\Inetpub\wwwroot\023291A-web-\db7.mdb;Persist 
>Security Info=False"
>strDB = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="
>conn.Open(Server.MapPath("db7.mdb"))
>
>strInsertSQL = "INSERT INTO Customer 
>(firstname,myemail,passwrd,number) 
>VALUES "
>strInsertSQL = strInsertSQL 
>& "('"&firstname&"'','"&myemail&"','"&passwrd&"',"&number&")"
>
>conn.execute strInsertSQL
>conn.close
>%>    
>


  Return to Index