# Re: Cursor 指到 Server 了

Posted by Joef on June 25, 1999 at 11:21:30:

In Reply to: Cursor 指到 Server 了 posted by Sephiroth on June 25, 1999 at 09:36:11:

: : 我是用程式方式去open database
: : Dim cnPersonal As Connection
: : Dim rsDepartment As Recordset
: : Dim c As Integer
: : Set cnPersonal = New Connection
: : Set rsDepartment = New Recordset

: : With cnPersonal
: : .Provider = "Microsoft.Jet.OLEDB.3.51"
: : .ConnectionString = "Data Source = d:\work\personal\personal.mdb;"
: : .Open
: : End With

: : With HFGDepartment
: : rsDepartment.Open "department", cnPersonal,adOpenDynamic
: : adLockReadOnly
: : .
: : .
: : .
: : end with
: : 我用过rsDepartment.Recordcount去读取department表格的总笔数,但是不行,
: : 不知我方法错误,可否告之如何读取谢谢

:
: 用以上的方法开启会将 Cursor指到 Server, 结果 RecordCount = -1
: 可以在 rsDepartment.Open 之前设定 .CursorLocation = adUseClient
: 如果想更了解 Cursor,可以参考 cww 的网站

我照你的方法,在Open之前指定CuosorLocation=adUserClient就解决了!
谢谢你^_^

Follow Ups: