Are you Serge?
What is your backend database?
I went to the web, and still unable to get it work.
Why bother? If you read the article I linked to, you will find a more
efficient method (using GetRows) for getting the record count than using an
expensive cursor for your recordset.
My codes:
sSQL = "SELECT * FROM myTable"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sSQL, myConn, 1, 3
You do not need an ultra-expensive keyset cursor (although it should work).
All you need is a static cursor. The locktype does not matter.
rs.Open sSQL, myConn, 3, 3, 1
recCount = rs.recordcount
rs.Close
Set rs = Nothing
response.write recCount
Does this reflect your actual purpose? You are opening a recordset for the
sole purpose of getting the record count? That's crazy! Don't pull all the
records from your table across the wire simply to count them.
sSQL = "SELECT count(*) FROM myTable"
set rs = conn.execute(sSQL,,1)
recCount = rs(0)
rs.Close
Set rs = Nothing
conn.Close
Set conn= Nothing
response.write recCount
It should not return -1 with a keyset cursor, unless the provider you are
using for your connection does not support bookmarks. That is why I asked
what database you are using, and why I am now asking you to show us your
connection string (with any password information censored of course).
Bob Barrows