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

ASP Access Query

Status
Not open for further replies.

crxcte1

Programmer
May 22, 2003
74
US
I'm not all that new to asp but can't seem to get past this problem. This query works fine without the where clause, but I get the error 80004005 with it.

SessionID=Session.sessionID
Set cn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset") cn.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" & server.MapPath("/_database/db2004.mdb")
cn.Open
SQL="Select count(*) from table1 where (Session = '" & SessionID & "' )"
'SQL="Select * from table1 " this works
cn.Execute(SQL) 'this is the line # on error

any help would be great
 
Try
"Development practices when using SQL/Interfaces"
faq333-4896

If that turns up nothing then post the output from teh sql after the server has interpruted it.
e.g.
Response.Write SQL
Response.End

___________________________________________________________________
[sub]
onpnt.com
SELECT * FROM programmers WHERE clue > 0
(0 row(s) affected) -->faq333-3811
[/sub]

 
> SQL="Select count(*) from table1 where (Session = '" & SessionID & "' )"


I notice in your where clause you use apostrophes around the SessionID variable. I know that it isn't necessary to use them with numeric fields, though I don't know if using them would actually cause it to break. You may want to try removing them though.
 
80004005 is a general ASP/ADO error, encompasses hoards of problems, as Fiz denoted, check your string/number values perhaps post the entirety of the error.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top