Click to See Complete Forum and Search --> : OLE DB Schema Rowsets & datatypes


DuncanW
April 28th, 2003, 09:14 PM
I am developing an application using VC++ 6.0 using ADO. I have run into a problem pulling Schema Rowsets from the OLE DB provider to MSAccess (Microsoft.Jet.OLEDB.4.0).

For instance, I want to pull the DATA_TYPE property of a column. I open the Column Rowsets with:

spRSet = spCon->OpenSchema( ADODB::adSchemaColumns, vaConstraints.GetArray() );

where the constraint is the table name. This rowset has a column named DATA_TYPE, which is documented as a DBTYPE_UI2. But when I pull the DATA_TYPE column with:

vtValue = spRSet->Fields->GetItem(_T("DATA_TYPE"))->Value;

the vtValue.vt = VT_I4 instead of VT_UI2 (= DBTYPE_UI2).

Similarly the CHARACTER_MAXIMUM_LENGTH column is documented as having a DBTYPE_I4, but when I pull this column with:

vtValue = spRSet->Fields->GetItem(_T("CHARACTER_MAXIMUM_LENGTH"))->Value;

the vtValue.vt = VT_R8 instead of VT_I4 (= DBTYPE_I4).

Does anyone have an idea why some of the columns in the schema rowsets have datatypes different than those documented?

The schema rowset documentation I am looking at is located at:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/oledb/htm/olprappendixb.asp

Thanks for any help.