Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql line format

Status
Not open for further replies.

clientuser

Programmer
Joined
Apr 18, 2001
Messages
296
Location
US
I keep getting this line is setup wrong:

strSQL = "INSERT INTO maillist_members " & "(FirstName, LastName, Email, listID) VALUES " & "('" strFirstName & "', '" & strLastName & "', '" & strEmail & "', " & "' & intListID & "')" & ";"

getting:

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/mailinglist2/subscribe_process.asp, line 31

strSQL = "INSERT INTO maillist_members " & "(FirstName, LastName, Email, listID) VALUES " & "('" strFirstName & "', '" & strLastName & "', '" & strEmail & "', " & "' & intListID & "')" & ";"
-------------------------------------------------------------------------------------------------^
 
Try This:

strSQL= "INSERT INTO maillist_members (FirstName, LastName, Email, listID) " & _
"VALUES('"&strFirstName&"','"&strLastName&"','"&strEmail&"',"&intListID&");"

Hope it will help you.
 
sorry but i get the same error:

Code:
strSQL= "INSERT INTO maillist_members (FirstName, LastName, Email, listID) " &_
"VALUES('"&strFirstName&"','"&strLastName&"','"&strEmail&"',"&intListID&");"
	objConn.Execute (strSQL)
 
What database do you use? I assume name of the fields are correct right and the order of the field Has to be
the same as the one in your table?

Try to put
Response.Write(strsql)
Response.End

Maybe this Link could also help you.
 
looks like broken line continuance issues, pretty common, there's a few ways to get it to work, try formatting the string like this :

strSQL= "INSERT INTO maillist_members (FirstName, LastName, Email, listID) "_
&"VALUES('"&strFirstName&"','"&strLastName&"','"&strEmail&"',"&intListID&")"

objConn.Execute (strSQL)

end quote, underscore, no space, and nothing other than carriage returns and spaces until ampersand open quote continue.....

also i removed the trailing semicolon, it's common for access DB's but not necessary, and not typically "liked" by SQL, just a minor habit i've removed from my standard practices, to ease headaches.


[thumbsup2]DreX
aKa - Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top