How To Keep RDO Cursor Open After Transaction (190109)
The information in this article applies to:
- Microsoft Visual Basic Enterprise Edition for Windows 4.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q190109 SUMMARY By default, the SQL Server ODBC driver automatically closes
cursor after a call to commit or rollback. If you reference the RDO resultset
afterwards, for example, rs.MoveNext, Debug.Print rs(0), the following error
occurs: Run-time error '40088': No open cursor
or cursor closed. This article demonstrates, in Visual Basic
6.0, how you can keep the cursor open by setting a driver-specific statement
option, using the SQLSetConnectOption API before establishing the connection.
This option is documented in the SQL Server ODBC Driver Help file, which you
can also obtain when installing the SQL Server Books Online.
However, this approach does not work in Visual Basic 5.0 using RDO (Msrdo20.dll
version 5.xx.xxxx) due to a known RDO bug. To reference the resultset after the
transaction, you must either Requery the resultset or use the Server-side
cursor driver and the rdExecDirect option of the connection object.
In Visual Basic 4.0, the resultset remains open after transaction.
Modification Type: | Minor | Last Reviewed: | 7/1/2004 |
---|
Keywords: | kbhowto KB190109 |
---|
|