I know I can use the select count(*) instead, but I've been researching this for quite some time now and I would like to know what's wrong.
Thx,
Why not use
If YourRecordSet.EOF Then
response.Write "Sorry No Records Found"
Else
'Output of Records found
End If
?????????
Just a simple question, but have you defined the variable adOpenStatic in your asp pages? adOpenStatic isn't defined by default, you have to define it a) yourself or b) include adodb.inc which is available from microsoft which defines all ADODB constants.
Dim lRS: Set lRS = CreateOBject("ADODB.RecordSet")
lRS.Open lCmd, , adOpenStatic
Response.Write lRS.RecordCount
-> w/o definition of adOpenStatic (which is then the same as "") it returns -1
if i do adOpenStatic = 3 and the execute it, it returns the valid RecordCount.
I use the .inc file from MS.
<%
Dim lConn
Set lConn = CreateObject("ADODB.Connection")
Dim lRS
Set lRS = CreateOBject("ADODB.RecordSet")
lRS.Open "SELECT * FROM TTodo", lConn, 3
Response.Write lRS.RecordCount
%>
Perhaps your provider/driver doesn't support adOpenStatic? Which driver are you using and which database?
there are some properties, that are not supported on mySQL server; one of such is adUseServer cursorLocation for counting the total of affected rows.
if you use adUseServer cursorLocation, you will get -1 as a number of affected rows, no matter what (even, if you properly open the connection, ie. adOpenStatic)
right solution is to use adUseClient cursorLocation. Here is a sample snippet of code: