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’

FIX: ADO DataControl and DataEnvironment Events Only Work with ADO 2.0

Symptoms
When you attempt to use the events of an ADO Data Control or the DataEnvironment with a reference to a version of the Microsoft ActiveX Data Objects (ADO) later than version 2.0, you receive the following error message:

Compile error:
Procedure declaration does not match description of event or procedure having the same name.
Resolution
The ADO Data Control and the Data Environment were compiled using Microsoft Data Access Components version 2.0.

PRB: Run-Time Error Message 430 with ADO Redistributed Application

Symptoms
When an ADO application is redistributed, it produces the following run-time error on the user’s computer:

Run-time Error 430
Class does not support automation or does not support expected interface.
Resolution
The application references one version of ADO and redistributes a different version of ADO.

PRB: Run-Time Error Message 3705 Occurs When Trying to Set the ActiveConnection Property of an ADO Recordset to Nothing

Symptoms
When you attempt to disconnect an ADO Recordset by setting its ActiveConnection Object property to Nothing, the following error message might appear:

Run-time error ‘3705′: Operation is not allowed when the object is open.
Resolution
Only client-side ADO recordsets can be disconnected. The specified error occurs only when you attempt to disconnect a server-side ADO recordset.

BUG: T-SQL PRINT Statement May Not Show as Informational Error

Symptoms
You can use Microsoft SQL Server’s PRINT statement in stored procedures to return messages as informational errors in ADO, OLE DB, and ODBC applications. However, a Visual Basic client application may not capture such informational messages when it sets up a DataEnvironment command and uses the DataEnvironment.CommandName syntax to run the stored procedure.
Resolution
This problem has its roots in ADO. The InfoMessage event of an ADO Connection object does not fire when its CursorLocation property is set to adUseClient. By default, the CursorLocation property of Visual Basic 6.0 DataEnvironment Connection objects is set to adUseClient. As a result, the InfoMessage event procedure of DataEnvironment Connection objects does not fire when informational messages are returned to the client application.

BUG: Recordset EditMode is Not Set Properly When Data is Modified Through Bound Controls

Symptoms
When using some controls bound to an ADO Recordset object, the EditMode is not set properly when you modify the data through the bound controls. These controls include the Microsoft DataCombo control.
With other controls bound to an ADO Recordset object, the EditMode is set properly when data is changed through the bound controls. These controls include the TextBox.
The expected behavior is that the EditMode is set properly for each type of bound control.
Resolution
The affected controls do not notify the Binding Collection that they are dirty.

BUG: DataGrid Does Not Handle Special Filter Constants Correctly

Symptoms
When the filter of an ADO Recordset object is set to one of the special constants, such as adFilterPendingRecords, the bound DataGrid control still displays all of the rows in the Recordset. If the filter is set to specify a particularfield, such as “State = ‘CA’,” the DataGrid displays only the rows that are specific to that filter.
Resolution
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.