Record Count question (yes it's a Keyset Cursor)
I'm just doing a basic little test to print out records and a record count, and even though I've set the cursor to adOpenKeyset (both with the CursorType=adOpenKeyset and w/i the objRS.Open properties) and it's still giving me the blasted -1 !!
I've also set the cursor location to client, and done some manipulations there as well.
Here's the code, any thoughts? Much appreciated!
<%
Dim objConn
Set objConn = CreateObject("ADODB.Connection")
objConn.ConnectionString="DSN=A_Test"
objConn.Open
Dim objRS, strSQL
Set objRS=Server.CreateObject("ADODB.Recordset")
strSQL="SELECT * FROM Products"
objRS.Open strSQL, objConn, adOpenKeyset
Response.Write "<B> A Listing of our Products </B><BR>"
Response.Write "Record Count: " & objRS.RecordCount & "<BR>"
Do While Not objRS.EOF
Response.Write objRS("Brand") & " " & objRS("Model") & "<BR>"
objRS.MoveNext
Loop
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
Yes, that definitely does work -
but I wonder why the recordcount property does not, even though I think I've got all the cursor settings correct.....
It's just the principle of knowing why :-)
In the meantime though, I will use your code so I can keep going with my happy little code!
Thanks very much!!