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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL statement??

Status
Not open for further replies.

pilg

Programmer
Feb 16, 2001
82
GB
Does this look OK to everyone:
SQL = "UPDATE externalcompany"
SQL = SQL + " SET CompanyName = '" & companyname & "', addresslineone= '" & addresslineone & "', Addesslinetwo= '" & addresslinetwo & "', citytown= '" & citytown & "', postcode= '" & postcode & "', LoB= '" & LoB & "', Business = '" & Business & "', Date1= '" & date1 & "'"
SQL = SQL + " WHERE CompanyID = '" & ID & "';"

I get an expected 1 error but I know I'm getting all the variables through as I've tested them, is the syntax OK.



 
do any of your variable have a single quote? After you form the string write.

response.write sql
resonse.end

and try to execute the string yourself in access (I assume). -----------------------------------------------------------------
"The difference between 'involvement' and 'commitment' is like an eggs-and-ham breakfast: the chicken was 'involved' - the pig was 'committed'."
- unknown

mikewolf@tst-us.com
 
Is CompanyID really a text field?
If not remove the quotes.

HTH
 
Your mixing your concatenation operators, if this is written in server-side javascript then you need to switch all the &'s to +'s, if VBScript than reverse that :)

SQL = "UPDATE externalcompany"
SQL = SQL + " SET CompanyName = '" & companyname & "', addresslineone= '" & addresslineone & "', Addesslinetwo= '" & addresslinetwo & "', citytown= '" & citytown & "', postcode= '" & postcode & "', LoB= '" & LoB & "', Business = '" & Business & "', Date1= '" & date1 & "'"
SQL = SQL + " WHERE CompanyID = '" & ID & "';"


Everything in red should be the same symbol.

-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
No more vacation for me :(

FAQ FAQ20-2863
= new Forums.Posting.General.GettingAnswers()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top