# RDO Problem (RowCount不正确)->vb6.0 EnterPrise

Posted by Lisa Chang on August 21, 1997 at 00:52:55:

Database：SQL-Server V6.50
连结Database的方式：RDO2.0 DSN-LESS
注： Vb己经有做Visual Studio 97 Service Pack Upgrades
问题描述：
将RDO Resultset的资料删空，再新增资料, RowCount会不正确。
相关程式码如下：
Dim cn As rdoConnection
Dim en As rdoEnvironment, conn As String
Dim rs1 As rdoResultset
Private Sub Form_Load()
Set en = rdoEnvironments(0)
en.CursorDriver = rdUseServer
conn = "UID=ad;PWD=d2d;DATABASE=db1;SERVER=DdfdCdEc;DRIVER={SQL SERVER};DSN='';"
Set cn = en.OpenConnection(dsname:="", Prompt:=rdDriverNoPrompt, Connect:=conn)
cn.Execute "delete test3 where t1=5"
Set rs1 = cn.OpenResultset("select * from test3 where t1=5", rdOpenKeyset, rdConcurLock)
MsgBox rs1.RowCount '0-正常
rs1.AddNew
rs1("t1") = 5
rs1("t2") = 9
rs1.Update
rs1.Bookmark = rs1.LastModified
MsgBox rs1.RowCount '1-正常
rs1.Delete
MsgBox rs1.RowCount '0-正常
rs1.AddNew
rs1("t1") = 5
rs1("t2") = 9
rs1.Update
rs1.Bookmark = rs1.LastModified
MsgBox rs1.RowCount '0-不正常，RowCount应为1
Set rs1 = cn.OpenResultset("select * from test3 where t1=5", rdOpenKeyset, rdConcurLock)
MsgBox rs1.RowCount '1-正常
End Sub

Private Sub Form_Unload(Cancel As Integer)
Set rowcount_bug = Nothing
End Sub

Follow Ups:

- 嗯．．． 小吴 17:38:13 8/21/97 (1)
  - Re: 嗯．．． Lisa Chang 19:45:50 8/21/97 (0)