🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #1567

Re: TADOConnection::OpenSchema question

#1567
From: Viatcheslav V. Vassiliev
Date: Tue, 18 May 2004 17:16
116 lines
4385 bytes
I now have no Oracle near so example is for MS SQL Server, but it should
work for other DBMS. This sample shows only user tables.


void __fastcall TForm1::Button1Click(TObject *Sender)
{
 ADOConnection1->ConnectionString = WideString("Provider=SQLOLEDB;"
  "Integrated security=SSPI;Initial catalog=pubs");
 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)


"Arnie Mauer" <xxx@nowhere.net> �������/�������� � �������� ���������:
news:40aa00ec@newsgroups.borland.com...
> Thanks Vassiliev,
>
> That works - sort of.  Actually it works fine for DB2 and SQL Server.
But,
> with Oracle 9i, I seem to be getting some duplicate table names as well as
> system tables.  Any ideas on the dups or getting rid of the system tables?
>
> Thanks,
> - Arnie
>
> "Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote in message
> news:40a9e424@newsgroups.borland.com...
> > Why v1(0) - it will be integer with value 0. You should pass empty
> parameter
> > (EmptyParam in Delphi).
> >
> >  OleVariant EmptyParam;
> >  EmptyParam.VType  = VT_ERROR;
> >  EmptyParam.VError = DISP_E_PARAMNOTFOUND;
> >
> >  OpenSchema(siTables, EmptyParam, EmptyParam, ds);
> >
> > //------------------------------------------
> > 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)
> >
> > "Arnie Mauer" <xxx@nowhere.net> �������/�������� � �������� ���������:
> > news:40a8f814$1@newsgroups.borland.com...
> > > Hi,
> > >
> > > I swear I had it working at one time but no longer have the code.  I
> just
> > > want to get a list of tables in the schema.
> > >
> > > Using:
> > >
> > >    db->Open();
> > >    TADODataSet * ds = new TADODataSet( db );
> > >    ds->Connection = db;
> > >    OleVariant v1(0), v2(0);
> > >    db->OpenSchema( siTables, v1, v2, ds );
> > >
> > > I get the "Arguments are of the wrong type, ..." error message on the
> > > OpenSchema call.  Any suggestions?
> > >
> > > Thanks,
> > > - Arnie
> > >
> > >
> > >
> >
> >
>
>
Technical Details
Message-ID: <40aa44e8@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40a8f814$1@newsgroups.borland.com> <40a9e424@newsgroups.borland.com> <40aa00ec@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10698b,9e7f498881b02be9
X-Google-Attributes: gid10698b,public
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <40a8f814$1@newsgroups.borland.com> <40a9e424@newsgroups.borland.com> <40aa00ec@newsgroups.borland.com>
Subject: Re: TADOConnection::OpenSchema question
Date: Tue, 18 May 2004 21:16:26 +0400
Lines: 118
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 213.234.218.42
Message-ID: <40aa44e8@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1084900584 213.234.218.42 (18 May 2004 10:16:24 -0700)
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail