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 ‘OLE’

FIX: AutoNumber Field Is Not Incremented When Using ADO

Symptoms
When using the ODBC, Microsoft Access, or SQL Server OLE DB Providers thefollowing may appear:
A “0″ displays in the AutoNumber (or Identity) field after addingrecords through the DataGrid control bound to an ActiveX Data Objects(ADO) Data ControlA “0″ is stored in the AutoNumber (or Identity) field after addingrecords to a recordset, using the AddNew method of the recordset. This only occurs when the CursorLocation is set to “3″ – adUseClient.
Resolution
By using the client-side cursors, the OLE DB provider is unable to requerythe server for the updated record, and a “0″ appears in place of thecorrect value. When you requery the recordset, the correct value appears.

FIX: ADO: Unable To Update Memo Field > 64K In Access Database

Symptoms
An attempt to update a large (64K or greater) memo field in a client-siderecordset using the Jet 3.51 OLE DB provider results in one of the followingerrors:

Errors occurred.
Run-time error ‘-2147217887(80040e21)’:-or-

Run-time error ‘-2147217259(80040005)’:Data provider or other service returned an E_FAIL status.
Resolution
This problem is caused by a bug in the Microsoft OLE DB Provider for Jetversion 3.51.

BUG: SSTab Control Containing OLE Control May Crash

Symptoms
On a Visual Basic form, an OLE control is placed on a Microsoft TabbedDialog control. You write code to embed a file into the OLE control usingthe CreateEmbed method. When the user clicks the tab that contains the OLEcontrol, one of the following errors occur and the application terminates:

VB5 caused an invalid page fault in module TABCTL32.OCX at0137:212f8b26.-or-

<Project Name> executed an invalid instruction in module OLE32.DLL at0137:65fa93ae.-or-

Exception: Access violation (0xc0000005), Address: 0×212f8b26
Resolution
To work around this problem, do one of the following:Place the OLE control inside a Frame control.
-or-Make the Tab that contains the OLE control the active tab before usingthe CreateEmbed method.

BUG: Identity field remains read-only after executing SET IDENTITY_INSERT ON statement

Symptoms
Identity columns are normally read-only because the server generates the values. However, when you migrate data from one table to another you often want to keep the existing Identity column values rather than use server-generated values. Microsoft SQL Server 7.0 allows you to do this with the SET IDENTITY_INSERT ON statement.
This operates correctly when you use INSERT INTO SQL statements. However, when you insert records through the AddNew method of an ActiveX Data Objects (ADO) Recordset, you receive the following error:

Run-time error ‘-2147217887 (80040e21)’
Multiple-step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done.
Resolution
The Microsoft SQL Server 7.0 OLE DB provider incorrectly reports to ADO that the Identity column is read-only.

A LIKE statement does not return any data with Oracle character data type

Symptoms
When you use Microsoft OLE DB Provider (MSDAORA) or the OLE DB .NET Data Provider for Oracle, if you use a LIKE statement to search fixed-length character types, Oracle does not find any rows if their padding is different.
Resolution
If you type a value into a fixed-length field that is shorter than the length of that field, the value is padded with trailing spaces to fill the fixed length. When Oracle matches values for fixed-length fields, it matches the entire length of the string, including any trailing spaces.
NOTE: This behavior is not specific to ADO.NET and also occurs when you use Microsoft ActiveX Data Objects (ADO).