Article View: borland.public.cppbuilder.database.ado
Article #441Re: TAdoConnection and OpenSchema
From: 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
Technical Details
Message-ID:
<440d4d60$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<440c3272$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,c12374b23767ae55 X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <440c3272$1@newsgroups.borland.com> Subject: Re: TAdoConnection and OpenSchema Date: Tue, 7 Mar 2006 12:07:39 +0300 Lines: 77 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2670 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 85.93.138.132 Message-ID: <440d4d60$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1141722464 85.93.138.132 (7 Mar 2006 01:07:44 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail