In Visual Studio 2003 C++ GetOleDbSchemaTable worked so:

DataTable* GetTables(OleDbConnection* conn)
{
conn->Open();
Object* restrictions[] = {0, 0, 0, S"TABLE"};
DataTable* schemaTable =
conn->GetOleDbSchemaTable(OleDbSchemaGuid::Tables, restrictions);
conn->Close();
return schemaTable;
};

How to make this in Visual Studio C++ 2005 ??

Help me !!

Hideen ;-)

Re: GetOleDbSchemaTable VS C++ 2005 by Hideen

Hideen
Tue Feb 07 15:06:42 CST 2006


U¿ytkownik "Hideen" <Hideen@nospam.org> napisa³ w wiadomo?ci
news:ds8cf6$e3f$1@nemesis.news.tpi.pl...
> In Visual Studio 2003 C++ GetOleDbSchemaTable worked so:
>
> DataTable* GetTables(OleDbConnection* conn)
> {
> conn->Open();
> Object* restrictions[] = {0, 0, 0, S"TABLE"};
> DataTable* schemaTable =
> conn->GetOleDbSchemaTable(OleDbSchemaGuid::Tables, restrictions);
> conn->Close();
> return schemaTable;
> };
>
> How to make this in Visual Studio C++ 2005 ??
>
> Help me !!
>
> Hideen ;-)
>

When I in VS 2005 write like :

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

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

Help me, please.



Re: GetOleDbSchemaTable VS C++ 2005 by Hideen

Hideen
Tue Feb 07 15:35:46 CST 2006


U¿ytkownik "Hideen" <Hideen@nospam.org> napisa³ w wiadomo?ci
news:dsb26a$3v9$1@atlantis.news.tpi.pl...
>
> U¿ytkownik "Hideen" <Hideen@nospam.org> napisa³ w wiadomo?ci
> news:ds8cf6$e3f$1@nemesis.news.tpi.pl...
>> In Visual Studio 2003 C++ GetOleDbSchemaTable worked so:
>>
>> DataTable* GetTables(OleDbConnection* conn)
>> {
>> conn->Open();
>> Object* restrictions[] = {0, 0, 0, S"TABLE"};
>> DataTable* schemaTable =
>> conn->GetOleDbSchemaTable(OleDbSchemaGuid::Tables, restrictions);
>> conn->Close();
>> return schemaTable;
>> };
>>
>> How to make this in Visual Studio C++ 2005 ??
>>
>> Help me !!
>>
>> Hideen ;-)
>>
>
> When I in VS 2005 write like :
>
> DataTable^ GetTables(OleDbConnection^ conn)
> {
> conn->Open();
> Object^ restrictions[] = {NULL, NULL, NULL, "TABLE"};
> DataTable^ schemaTable =
> conn->GetOleDbSchemaTable(OleDbSchemaGuid::Tables, restrictions);
> conn->Close();
> return schemaTable;
> };
>
> I receive error:
> error C2728: 'System::Object ^' : a native array cannot contain this
> managed type
> Did you mean 'array<System::Object ^>'?
>
> Help me, please.
>

OK
I write this like:

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

and ... works ;-)



Re: GetOleDbSchemaTable VS C++ 2005 by Hideen

Hideen
Tue Feb 07 16:26:38 CST 2006


U¿ytkownik "Hideen" <Hideen@nospam.org> napisa³ w wiadomo?ci
news:dsb3u8$d2i$1@nemesis.news.tpi.pl...
>
> U¿ytkownik "Hideen" <Hideen@nospam.org> napisa³ w wiadomo?ci
> news:dsb26a$3v9$1@atlantis.news.tpi.pl...
>>
>> U¿ytkownik "Hideen" <Hideen@nospam.org> napisa³ w wiadomo?ci
>> news:ds8cf6$e3f$1@nemesis.news.tpi.pl...
>>> In Visual Studio 2003 C++ GetOleDbSchemaTable worked so:
>>>
>>> DataTable* GetTables(OleDbConnection* conn)
>>> {
>>> conn->Open();
>>> Object* restrictions[] = {0, 0, 0, S"TABLE"};
>>> DataTable* schemaTable =
>>> conn->GetOleDbSchemaTable(OleDbSchemaGuid::Tables, restrictions);
>>> conn->Close();
>>> return schemaTable;
>>> };
>>>
>>> How to make this in Visual Studio C++ 2005 ??
>>>
>>> Help me !!
>>>
>>> Hideen ;-)
>>>
>>
>> When I in VS 2005 write like :
>>
>> DataTable^ GetTables(OleDbConnection^ conn)
>> {
>> conn->Open();
>> Object^ restrictions[] = {NULL, NULL, NULL, "TABLE"};
>> DataTable^ schemaTable =
>> conn->GetOleDbSchemaTable(OleDbSchemaGuid::Tables, restrictions);
>> conn->Close();
>> return schemaTable;
>> };
>>
>> I receive error:
>> error C2728: 'System::Object ^' : a native array cannot contain this
>> managed type
>> Did you mean 'array<System::Object ^>'?
>>
>> Help me, please.
>>
>
> OK
> I write this like:
>
> DataTable^ GetTables(OleDbConnection^ conn)
> {
> conn->Open();
> array<String^>^ myArray;
> myArray = gcnew array<String^> {"0", "0", "0", "TABLE"};
> DataTable^ schemaTable =
> conn->GetOleDbSchemaTable(OleDbSchemaGuid::Tables, myArray);
> conn->Close();
> return schemaTable;
> };
>
> and ... works ;-)
>

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

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