Discussion Locked

ASP ADO Problem

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have an ASP page which makes an ADO connection to an Access database. I then try to create a recordset from a constructed SQL statement but always obtain zero hits. I can run the SQL statement on the database and it works.
I have checked the IUSRpermissions and the odbc setup which looks fine. The code has been checked against samples from books and technet and looks fine.
Any ideas?

7 replies

by roc180

Set your recordset type to forward only. This will set you at the first rec.

Rst.Open strSQL,Conn,adOpenForwardOnly,adLockReadOnly

If Rst.recordcount>0 Then
'I have records
Else
'I have NO records
End if

If this does not provide you with the correct results, feel free to send me your code and I will take a look at it.

Good Luck

Neal Martinelli

by gbworld

Not sure how you are running this. ADO recordsets, by default, in ASP return no records if you try to count the number of records in them (actually should return a -1). If you are talking count, this is most likely your problem.

If you are not talking count, but are talking the output of the recordset, then the first place to look is at your "constructed" SQL Statement.

A good way to check code is to use response.write at strategic places and check the code output (esp. in the case of a SQL statement). In the case of a SQL statement, this means running it against the database.

Another problem you might have is using the latest version of Access, but not the latest MDAC. To download the latest, check out www.microsoft.com/data -- this will require a reboot on 9x or ME.

I would have to see the code to go deeper into this one.

GB

This discussion is closed to new replies.