Click to See Complete Forum and Search --> : Command Object Problem


Blue Sky
March 1st, 2001, 05:20 AM
Following is part of my code :

..............
..............

connString = "Provider=SQLOLEDB.1;" & _
"Data Source=JYP;" & _
"Initial Catalog=CUSTOMER;" & _
"Integrated Security=SSPI;" & _
"Persist Security Info=false"

'Use client-side cursor
conn.CursorLocation = adUseClient

'Open the connection
conn.Open connString

'cmmd is a command object
cmmd.ActiveConnection = connString
cmmd.CommandType = adCmdStoredProc
cmmd.CommandText = "StartEditCls"

rs.CursorType = adOpenStatic
rs.LockType = adLockReadOnly
rs.ActiveConnection = conn

'Use Stored Procedure---named StartEditCls
set rs = cmmd.Execute



At the beginning, there is no record in the table.
But I found out that rs.recordcount = -1 , not 0.
Why ????
Can anyone explain it to me?
Thanks

TH1
March 1st, 2001, 05:55 AM
-1 means that it cant return the recordcount
if you put conn.CursorLocation = adUseClient then test the recordcount it will return it correctly

Srikanth_hlp
March 1st, 2001, 02:00 PM
recordcount will always have -1 for a forward only cursors and for all other cursor types u can get the exact recordcount only when u access the last record in the recordset.It has nothing to do with client side cursor or server side cursor i suppose