Thread View: borland.public.cppbuilder.database.ado
3 messages
3 total messages
Started by Cabrera
Mon, 06 Mar 2006 12:00
TAdoConnection and OpenSchema
Author: Cabrera
Date: Mon, 06 Mar 2006 12:00
Date: Mon, 06 Mar 2006 12:00
19 lines
1381 bytes
1381 bytes
I want to read all tables names and I write
....
int bounds[] = {0,3};
OleVariant A(bounds,1, varVariant);
A.PutElement(varEmpty,0);
A.PutElement(varEmpty,1);
A.PutElement(varEmpty ,2);
A.PutElement("TABLE",3);
m_cpConnection->OpenSchema(siTables,A,varEmpty,m_cpRecordset);
m_cpConnection is derived from TAdoConnection and is activ
m_cpRecordset is als TAdoDataset declared, i use CBuilder6
By attempting to run this code I receive a Exception (the Parameters are wrong .....
How can I do???
Thanks
Re: TAdoConnection and OpenSchema
Author: Viatcheslav V. Vassiliev
Date: Tue, 07 Mar 2006 09:07
Date: Tue, 07 Mar 2006 09:07
75 lines
3126 bytes
3126 bytes
void __fastcall TForm1::Button1Click(TObject *Sender)
{
ADOConnection1->ConnectionString =
WideString("Provider=Microsoft.Jet.OLEDB.4.0;"
"Data Source=c:\\temp\\test.mdb");
ADOConnection1->Connected = true;
OleVariant EmptyParam;
EmptyParam.VType = VT_ERROR;
EmptyParam.VError = DISP_E_PARAMNOTFOUND;
SAFEARRAY FAR* psa = NULL;
SAFEARRAYBOUND rgsabound;
OleVariant var;
OleVariant Array;
rgsabound.lLbound = 0;
rgsabound.cElements = 4;
psa = SafeArrayCreate(VT_VARIANT, 1, &rgsabound);
var.VType = VT_EMPTY;
long ix;
ix = 0;
SafeArrayPutElement(psa, &ix, &var);
ix = 1;
SafeArrayPutElement(psa, &ix, &var);
ix = 2;
SafeArrayPutElement(psa, &ix, &var);
var.VType = VT_BSTR;
var.VOleStr = WideString("TABLE"); //Look possible values in TABLE_TYPE
column
//when there is no restrictions
ix = 3;
SafeArrayPutElement(psa, &ix, &var);
Array.VType = VT_ARRAY | VT_VARIANT;
Array.VArray = (TVarArray*)psa;
ADOConnection1->OpenSchema(siTables, Array, EmptyParam, ADODataSet1);
}
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Cabrera" <ivette.garrido@biesenbruc.de> �������/�������� � ��������
���������: news:440c3272$1@newsgroups.borland.com...
>
> I want to read all tables names and I write
> ....
> int bounds[] = {0,3};
> OleVariant A(bounds,1, varVariant);
> A.PutElement(varEmpty,0);
> A.PutElement(varEmpty,1);
> A.PutElement(varEmpty ,2);
> A.PutElement("TABLE",3);
>
> m_cpConnection->OpenSchema(siTables,A,varEmpty,m_cpRecordset);
>
> m_cpConnection is derived from TAdoConnection and is activ
> m_cpRecordset is als TAdoDataset declared, i use CBuilder6
>
> By attempting to run this code I receive a Exception (the Parameters are
> wrong .....
>
> How can I do???
> Thanks
Re: TAdoConnection and OpenSchema
Author: Cabrera
Date: Tue, 07 Mar 2006 14:51
Date: Tue, 07 Mar 2006 14:51
80 lines
3279 bytes
3279 bytes
"Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote:
>void __fastcall TForm1::Button1Click(TObject *Sender)
>{
> ADOConnection1->ConnectionString =
>WideString("Provider=Microsoft.Jet.OLEDB.4.0;"
> "Data Source=c:\\temp\\test.mdb");
> ADOConnection1->Connected = true;
>
> OleVariant EmptyParam;
> EmptyParam.VType = VT_ERROR;
> EmptyParam.VError = DISP_E_PARAMNOTFOUND;
>
> SAFEARRAY FAR* psa = NULL;
> SAFEARRAYBOUND rgsabound;
> OleVariant var;
> OleVariant Array;
> rgsabound.lLbound = 0;
> rgsabound.cElements = 4;
>
> psa = SafeArrayCreate(VT_VARIANT, 1, &rgsabound);
> var.VType = VT_EMPTY;
>
> long ix;
> ix = 0;
> SafeArrayPutElement(psa, &ix, &var);
>
> ix = 1;
> SafeArrayPutElement(psa, &ix, &var);
>
> ix = 2;
> SafeArrayPutElement(psa, &ix, &var);
>
> var.VType = VT_BSTR;
> var.VOleStr = WideString("TABLE"); //Look possible values in TABLE_TYPE
>column
> //when there is no restrictions
> ix = 3;
> SafeArrayPutElement(psa, &ix, &var);
>
> Array.VType = VT_ARRAY | VT_VARIANT;
> Array.VArray = (TVarArray*)psa;
>
> ADOConnection1->OpenSchema(siTables, Array, EmptyParam, ADODataSet1);
>}
>
>//------------------------------------------
>Regards,
>Vassiliev V. V.
>http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
>ADO.Net
>http://www.oledbdirect.com - The fastest way to access MS SQL Server,
>MS Jet (Access) and Interbase (through OLEDB)
>
>
>"Cabrera" <ivette.garrido@biesenbruc.de> �������/�������� � ��������
>���������: news:440c3272$1@newsgroups.borland.com...
>>
>> I want to read all tables names and I write
>> ....
>> int bounds[] = {0,3};
>> OleVariant A(bounds,1, varVariant);
>> A.PutElement(varEmpty,0);
>> A.PutElement(varEmpty,1);
>> A.PutElement(varEmpty ,2);
>> A.PutElement("TABLE",3);
>>
>> m_cpConnection->OpenSchema(siTables,A,varEmpty,m_cpRecordset);
>>
>> m_cpConnection is derived from TAdoConnection and is activ
>> m_cpRecordset is als TAdoDataset declared, i use CBuilder6
>>
>> By attempting to run this code I receive a Exception (the Parameters are
>> wrong .....
>>
>> How can I do???
>> Thanks
>
> Wonderfull!!!It's works fine
Thanks X 100000000000000
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads