🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: List of Views of SQL Server with OpenSchema

#2324
From: Viatcheslav V. Vassiliev
Date: Wed, 20 Aug 2003 12:16
58 lines
2553 bytes
Views schema is not supported by MS SQL Server. You should use tables schema
with restrictions:

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");    //May be "SYSTEM VIEW"

 ix = 3;
 SafeArrayPutElement(psa, &ix, &var);

 Array.VType  = VT_ARRAY | VT_VARIANT;
 Array.VArray = (TVarArray*)psa;

 ADOConnection1->OpenSchema(siTables, Array, EmptyParam, ADODataSet1);
}

"Paulo S�rgio Tesche" <ptesche@via-rs.net> ???????/???????? ? ????????
?????????: news:3F427E87.8050309@via-rs.net...
> Hi,
>
> Has anynone a code sample in C++ Builder to retrieve the list of views
> of an SQL Server using TADOConnection and OpenSchema?
> I�m stucked with the Variant types. How to create them, how to pass them
> as parametes to OpenSchema?
>
> Any help greatle appreciated.
>
> Paulo Tesche
>
Technical Details
Message-ID: <3f4366d8@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!newsfeed.news2me.com!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3F427E87.8050309@via-rs.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10698b,38216bdf85b92e32
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2003-08-20 05:25:55 PST
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3F427E87.8050309@via-rs.net>
Subject: Re: List of Views of SQL Server with OpenSchema
Date: Wed, 20 Aug 2003 16:16:42 +0400
Lines: 60
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 213.247.201.57
Message-ID: <3f4366d8@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1061381848 213.247.201.57 (20 Aug 2003 05:17:28 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!newsfeed.news2me.com!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail