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

Suicidal with SQL string execution!

Status
Not open for further replies.

MadJock

Programmer
May 25, 2001
318
GB
The following ain't working but no error message is produced. No code following this is executed either. I think it's one of these ANNOYING mistakes that you don't see for looking at!

Any help much appreciated!!
-----------------------------------------------

strSQL2 = "SELECT tblSubCat.SUBCATID, tblSubCat.CODE FROM tblComplaintType, tblSubCat, tblCategory WHERE "

strSQL2 = strSQL2 & "tblCategory.CATID = tblSubCat.CATEGORYID AND "

strSQL2 = strSQL2 & "tblCategory.COMPLAINTTYPEID = tblComplaintType.COMPLAINTTYPEID AND "

strSQL2 = strSQL2 & "tblComplaintType.COMPLAINTTYPEID=" &
Request.Form("cboReconType") & ";"

Set rs = Conn.Execute(strSQL2)
---------------------------------------------------------

Background info - Have successfully used same code (with different SQL string) earlier on page. Conn is a microsoft jet OLE connection. Any fields ending in 'ID' are of LONG datatype. Any others are strings.
 
try

response.write(strSQL2)

right before you open your recordset to see what's contained in the string.

If your error isn't apparent, then post the results here.

You might also try explicitly creating your recordset like so:

dim rs
set rs = server.createObject("ADODB.Recordset")
rs.open strSQL2, Conn

Sometimes, that implicit creation of a recordset causes problems (even though it should work).

:)
paul
penny.gif
penny.gif
 
I'll agree with link9. Response.write your SQL string before you execute it. If you don't see any obvious errors, copy SQL string from response.write and paste into query analyzer. It will give you a descriptive ;-) error message
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top