使用oracle(ASP)ADODB Recordset.Recordcount损坏

时间:2022-06-10 05:29:18

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.

由于某些未知原因,当我尝试从ASP中的ADODB.Recordset对象读取RecordCount属性时,会导致奇怪的数据损坏,这些数据看起来并不符合我能找到的任何特定模式。我正在使用ASP连接到Oracle 10g数据库。以下是我正在使用的代码。

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.

出于某种原因,如果我调用c_objRS.RecordCount,则从此记录集读取的某些CLOB对象仅返回值null。如果我不调用它,或者我调用c_objRS.Close然后调用c_objRS.Open,那么它的工作正常。此外,c_objRS.Requery似乎可以解决问题。

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

我目前正在使用ODAC 11.1.0.6.21

Any help would be much appreciated!

任何帮助将非常感激!

2 个解决方案

#1


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

尝试MoveNext或MoveLast然后使用MoveFirst。这可能有所帮助。

#2


Try this:

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

#1


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

尝试MoveNext或MoveLast然后使用MoveFirst。这可能有所帮助。

#2


Try this:

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