Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Recordcount Issue

Author  Topic 

Bobba Buoy
Starting Member

36 Posts

Posted - 2003-08-07 : 06:19:40
This is weird. I have (identical) copies of sql server running on two seperate machines. I have a vb app that accesses the data. It runs with both dbs but I have the following function that I call to show the record count in a particular display:

Code:--------------------------------------------------------------------------------

Dim rs As Recordset

'determines number of records in a sql statement
Set rs = New ADODB.Recordset
rs.Open sql, conn, adOpenStatic, adLockOptimistic
RecordCount = rs.RecordCount
rs.Close
Set rs = Nothing

--------------------------------------------------------------------------------With one db it works just fine but with the other it returns a value of -1 even though the data is displayed just fine. Any ideas?

p2bl
Yak Posting Veteran

54 Posts

Posted - 2003-08-07 : 07:06:09
the problerm is here
rs.Open sql, conn, adOpenStatic, adLockOptimistic

try this
rs.Open sql, conn, adOpenStatic, adLockReadOnly

========================
look!
Go to Top of Page
   

- Advertisement -