Home All Groups Group Topic Archive Search About

GetOleDbSchemaTable VS 2005 C++

Author
8 Feb 2006 2:20 PM
Hideen
In Visual Studio 2003 C++  GetOleDbSchemaTable worked so:
DataTable* GetTables(OleDbConnection* conn)
{
    Object* restrictions[] = {0, 0, 0, S"TABLE"};
    DataTable* schemaTable =
    conn->GetOleDbSchemaTable(OleDbSchemaGuid::Tables, restrictions);
    return schemaTable;
};

How to make this in Visual Studio C++ 2005 ??
When I in VS 2005 write like :

DataTable^ GetTables(OleDbConnection^ conn)
{
    Object^ restrictions[] = {NULL, NULL, NULL, "TABLE"};
    DataTable^ schemaTable =
    conn->GetOleDbSchemaTable(OleDbSchemaGuid::Tables, restrictions);
    return schemaTable;
};

I receive error: error C2728: 'System::Object ^' : a native array cannot
contain this managed type
Did you mean 'array<System::Object ^>'?

I write this like:
DataTable^ GetTables(OleDbConnection^ conn)
{
    array<String^>^ myArray;
    myArray = gcnew array<String^> {"0", "0", "0", "TABLE"};
    DataTable^ schemaTable =
    conn->GetOleDbSchemaTable(OleDbSchemaGuid::Tables, myArray);
    return schemaTable;
};

it does not work because myArray has to be type Obiect^.

"at System.Data.OleDb.OleDbConnectionInternal.GetSchemaRowset(Guid schema,
Object[] restrictions)"

HELP !!!

AddThis Social Bookmark Button