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

sql variable...

Status
Not open for further replies.

mjonson

Technical User
Mar 9, 2004
128
GB
have the following sql statement

strsqlacc = "SELECT tbl_acc.accid,tbl_acc.acccost,tbl_acc.accdesc, tbl_deal.dealid FROM (tbl_acc INNER JOIN tbl_acclink ON tbl_acc.accid = tbl_acclink.accid) INNER JOIN tbl_deal ON tbl_acclink.dealid = tbl_deal.dealid WHERE (((tbl_deal.dealid)= 1));"

instead of the last line i want to put a variable in
eg

WHERE (((tbl_deal.dealid)= " & tkey & "));"

but it doesnt seem to work
ne ideas?
 
errr... refreshed and it started working
will check more carefully
 
this definately doesnt work i get

Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[MySQL][ODBC 3.51 Driver][mysqld-4.0.21-debug]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '))' at line 1
/dfasp/dealaddmain.asp, line 265
 
it looks like you have too many brackets.

try this...
Code:
strsqlacc = "SELECT tbl_acc.accid,tbl_acc.acccost,tbl_acc.accdesc, tbl_deal.dealid FROM (tbl_acc INNER JOIN tbl_acclink ON tbl_acc.accid = tbl_acclink.accid) INNER JOIN tbl_deal ON tbl_acclink.dealid = tbl_deal.dealid WHERE tbl_deal.dealid = " & tkey & ";"

Tony
________________________________________________________________________________
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top