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 for the ‘data access’ Category

PRB: 32-bit BASIC Does Not Convert UNICODE/ANSI in Binary Field

Symptoms
When using a binary field to store text in a Microsoft Jet 2.5 or earlierdatabase, 32-bit applications cannot read text written by 16-bitapplications and vice versa.
Resolution
Unlike Memo fields, the 32-bit programs do no automatic ANSI/UNICODEconversion on binary fields.

PRB: “Unable to Display Help” or “No Help Available” Error Messages for ADO from Within Visual Basic

Symptoms
When you try to access ActiveX Data Objects (ADO) documentation from within Visual Basic by pressing F1 from the code editor or from within the object browser, nothing occurs, or you receive one of the following error messages:

Unable to display help
-or-

No help available
Resolution
This problem occurs because the following items must exist to access context-sensitive help for ADO in the Visual Basic IDE: The correct version of the ADO compiled HTML help file that corresponds to the ADO version that is referenced in the project references. -and-
An entry in the registry that lists this ADO compiled HTML help file as an available HTML help file. This problem is known to occur when one or both of these items are missing.

PRB: “Too Many Columns Defined in the Rowset” Error Message

Symptoms
Running under versions of Microsoft Data Access Components (MDAC) prior to 2.5, you get the following error when choosing a Recordset object:

Run-time error ‘-2147024882 (8007000e)’Too many columns defined in the rowset.Running under MDAC 2.5 and later, you get the following error:

Run-time error ‘-2147024882 (8007000e)’:Rowsets cannot contain more than 2048 columns.
Resolution
Prior to MDAC 2.5, the client-cursor engine supported a maximum of 255 fields.
Under MDAC versions 2.5 and later, the client-cursor engine supports a maximum of 2048 fields.

PRB: “Operation Must Use an Updateable Query” Error Message When You Access Excel Through ODBC

Symptoms
When you edit an Excel worksheet through ADO and ODBC, you may receive the following error message if you use an ADO DataControl object:

[Microsoft][ODBC Excel Driver] Operation must use an updateable query.If you use a Recordset object that is generated with ADO code, you may receive the following error message when you edit an Excel worksheet through ADO and ODBC:

Run-time error ‘-2147467259(80004005)’:[Microsoft][ODBC Excel Driver] Operation must use an updateable query.
Resolution
This problem occurs if you try to edit a worksheet that is saved or opened as ReadOnly.
NOTE: ReadOnly is the default setting for an ODBC connection to Excel, with or without a data source name (DSN). Therefore, the user must always change that setting to edit data.

PRB: “Argument Not Optional” Error Using DAO 3.5

Symptoms
After porting a Visual Basic 4.0 program that is written using DAO 3.0(Data Access Objects) to DAO 3.5, the error message:

“Argument Not Optional”will occur on the Update, Movelast, and CommitTrans methods. This does nothappen in Visual Basic 5.0.
Resolution
In DAO 3.0, the methods listed above do not use optional arguments. They douse optional arguments in DAO 3.5. This is a problem caused by adding theTyped Optional Parameter feature to OLE Automation. Only newer Automationcontrollers such as Visual Basic 5.0 are going to understand this. VisualBasic 4.0 can accept optional parameters only if they are of the Variantdata type. The optional arguments for the methods listed above are notVariant so it doesn’t recognize them as optional.

PRB This Action was Cancelled by an Associated Object.(3426)”

Symptoms
This article discusses the error message “This action was cancelled by anassociated object.” that Visual Basic generates when working with Accessdatabases and the Data control. This article does not apply to the ADO datacontrol.
Resolution
This error is being generated because the AddNew command of a boundrecordset causes Visual Basic to try to save the current record if the datahas changed. Because the data control is currently pointing to a NULLrecord and not an empty record, the data cannot be saved so the “action wascancelled by an associated object” error is reported. This is commonly seenwhen using the data form wizard in Visual Basic versions 4.0 and 5.0. Thedata form wizard in Visual Basic 6.0 generates code for the ADO datacontrol so this error is less likely to occur.