Visual Basic Q&A

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘ado recordset’

FIX: Error in VBA6.DLL Using a Late Bound Recordset When at BOF or EOF

Symptoms
If you reference a field value in an ActiveX Data Objects (ADO) recordset when BOF or EOF is true, if you use late binding, and if you concatenate it to a string, an unhandled exception occurs in VBA6.DLL and causes an error.
Under Windows 95 or Windows 98, you receive the following error message:

VB6 Has Caused An Error in VBA6.DLLUnder Windows NT 4.0, you receive the following Dr. Watson error:

An application error has occurred and an application error log is being generated. VB6.EXE. Exception: access violation (0xc0000005) address 0×0fa91abdUnder Windows 2000, Visual Basic quits.
Resolution
If you pass a reference to an ADO field value when BOF or EOF is true, the following error message normally appears:

Either BOF or EOF is true, or the current record has been deleted. Requested operation requires a current record.However, if you reference a field value in an ADO recordset when BOF or EOF is true, if you use late binding, and if you concatenate it to a string, an unhandled exception occurs in VBA6.DLL and causes the above-mentioned error messages.

BUG: Error Message “Rows Must Be Released” with SQLOLEDB and ADO Recordset Events

Symptoms
If a user opens an ActiveX Data Object (ADO) recordset by using the OLE DB Provider for SQL Server, sets the CursorLocation property to adUseServer, uses the WithEvents keyword, updates the same record more than once, and then executes a Move method such as MoveNext, the following error message appears
in MDAC versions 2.5 and later:

80040e25: Row handles must be released before new ones can be obtainedin prior MDAC versions:

All HROWs must be released before new ones can be obtained
Resolution
This error message can be avoided in one of the following ways:Using a CursorLocation property of adUseClient.
-or-
Implementing code that moves off the changed record after each Update (for example, a MoveNext and MovePrevious method pair).
-or-
Executing the Requery method of the Recordset after each Update.