Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 bad sql syntax?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-08-21 : 00:22:17
Vagelis writes "Set cn = Server.CreateObject("ADODB.Connection")
cn.open "DATABASE=testdb;DSN=testdb;UID=sa;Password=;"

pf_idnew = Request.QueryString("pf_id")
dept_idnew = Request.QueryString("dept_id")

Response.Write(pf_idnew)

REM -- retrieve product:

REM -- retrieve product:

sql = "SELECT pf.pf_id, pf.name, pf.description, pf.list_price, pf.image_file, pf.image_width, pf.image_height, pf.sale_price, pf.sale_start, pf.sale_end, pf.attr_label1, pf.attr_label2, pf.attr_label3, pf.attr_label4, pf.attr_label5, dept.dept_id, dept.dept_name FROM vagelis_product pf, vagelis_dept dept, vagelis_dept_prod deptprod WHERE pf.pf_id = pf_idnew and pf.pf_id = deptprod.pf_id and dept.dept_id = deptprod.dept_id and dept.dept_id =" & dept_idnew
Set rsProduct = cn.execute(sql)

when i execute the above code i get the foolwing error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'pf_idnew'.

Could you please tell me what is wrong with the syntax?"
   

- Advertisement -