Article View: borland.public.cppbuilder.database.ado
Article #2022Re: Problem using ADOConnection->OpenSchema
From: Daniel Stevenson
Date: Thu, 11 Dec 2003 22:02
Date: Thu, 11 Dec 2003 22:02
117 lines
4856 bytes
4856 bytes
The good thing is that your code compiles and executes without any problems,
the bad news is that I don't know how to retrieve any information.
I was assuming that the ADODataSet1 would hold all the information returned
from the OpenSchema call, but my dataset is empty.
Can you shed some light on how the ADODataSet1 is to be initialised and also
how to retreive information once the open schema function has been executed?
....sorry for being so dumb
I am currently initialising the ADODataSet1 as seen below
TADODataSet* ADODataSet1 = new TADODataSet(NULL);
std::auto_ptr<TADODataSet> auto_dataSet(ADODataSet1);
and also just to ensure I'm on the right track, the function below is meant
to return all the table names from within the ADOConnection. Can you also
explain what "View" is meant to represent, from what I can gather it is a
'TABLE_TYPE' associated with the siTables? should I be replacing this with
one of my table names?
...as you can tell I'm quite confused with how to properly use this
function.
Thanks for your patience
"Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote in message
news:3fd81217@newsgroups.borland.com...
> Here is the code to enumerate views in MS SQL Server but it shows what you
> need.
>
> 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("VIEW");
> 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 + ADO.Net
> http://www.oledbdirect.com - The fastest way to access MS SQL Server,
> MS Jet (Access) and Interbase (through OLEDB)
>
> "Daniel Stevenson" <d.stevenson@ocreage.com.au> �������/�������� �
��������
> ���������: news:3fd808b7$1@newsgroups.borland.com...
> > I'm trying to return some information using the openschema as seen below
> >
> >
> > Variant tvars[3] = { Unassigned(), Unassigned(), "tablename" };
> >
> > TADODataSet* dataSet = new TADODataSet(NULL);
> > std::auto_ptr<TADODataSet> auto_dataSet(dataSet);
> >
> > ADOConnection->OpenSchema(siPrimaryKeys , VarArrayOf(tvars, 2),
NULL,
> > dataSet);
> >
> > //where tablename is the name of one of the tables within my
database
> >
> >
> > This seems to compile ok but when it is executed it returns the
following
> > error
> >
> > "Arguments are of the wrong type, are out of acceptable range, or
are
> in
> > conflict with one another."
> >
> > I unfortunately don't know a lot about OpenSchema and was using someone
> > else's code they posted earlier.
> >
> > Any Help as to where I am going wrong would be greatly appreciated.
> >
> >
>
>
Technical Details
Message-ID:
<3fd8e984$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!priapus.visi.com!orange.octanews.net!news.octanews.net!news-out.visi.com!petbe.visi.com!in.100proofnews.com!in.100proofnews.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3fd808b7$1@newsgroups.borland.com> <3fd81217@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10698b,dcb82e1dc41db4f2 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2003-12-11 14:09:48 PST From: "Daniel Stevenson" <d.stevenson@ocreage.com.au> Newsgroups: borland.public.cppbuilder.database.ado References: <3fd808b7$1@newsgroups.borland.com> <3fd81217@newsgroups.borland.com> Subject: Re: Problem using ADOConnection->OpenSchema Date: Fri, 12 Dec 2003 09:02:44 +1100 Lines: 119 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: 202.174.228.150 Message-ID: <3fd8e984$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1071180164 202.174.228.150 (11 Dec 2003 14:02:44 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!priapus.visi.com!orange.octanews.net!news.octanews.net!news-out.visi.com!petbe.visi.com!in.100proofnews.com!in.100proofnews.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail