views:

413

answers:

2

For some unknown reason, when I try to read the RecordCount property from an ADODB.Recordset object in ASP it causes strange data corruption that doesn't appear to follow any particular pattern that I can find. I'm using ASP to connect to an Oracle 10g database. The following is the code I am using.

c_objRS.Open strSql, objPage.objCn, adOpenStatic, adLockReadOnly, adCmdText  
DB_ReadListCount = c_objRS.RecordCount

For some reason, some CLOB objects that are read from this recordset return the value null ONLY if I call c_objRS.RecordCount. If I do not call it, or if I call c_objRS.Close then c_objRS.Open, then it works just fine. Also c_objRS.Requery appears to fix the issue.

I don't really want to use these methods at the moment because I fear some level of data corruption via opening and closing the result set and I do not want to re-run another query since the table in question can eventually become quite huge.

I'm currently using ODAC 11.1.0.6.21

Any help would be much appreciated!

A: 

Try MoveNext or MoveLast then use MoveFirst. This might help.

schar
A: 

Try this:

If Not c_objRS.EOF Then
  c_objRS.MoveNext
  DB_ReadListCount = objRS.RecordCount
Else
  DB_ReadListCount = 0
End If
AcousticBoom