🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

ADOConnection1->OpenSchema(siPrimaryKeys , Array, EmptyParam, (TADODataSet*)p_PKList);

#1691
From: John Z Fields
Date: Wed, 07 Apr 2004 12:43
67 lines
2557 bytes
Please help. I have code that gets primary key information for a table. This
works with Oracle, but generates an error with SQL Server and Sybase. Please
advise if you have been able to get this to work with these vendors. Many
thanks!

The error generated is
---------------------------
Error Determining catalog
---------------------------
Object or provider is not capable of performing requested operation
---------------------------
OK
---------------------------

I am running SQL Server 2000, with MDAC v 2.8. I am using Borland C++
Builder V6

The code is as below.


  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_BSTR;
 var.VOleStr = WideString("PEPCO2");  //catalog
 long ix;
 ix = 0;
 SafeArrayPutElement(psa, &ix, &var);

 var.VOleStr = WideString("dbo");
 ix = 1;
 SafeArrayPutElement(psa, &ix, &var);

 var.VOleStr = WideString(Edit1->Text);  //name of table
 ix = 2;
 SafeArrayPutElement(psa, &ix, &var);

 var.VType = VT_EMPTY;
 ix = 3;
 SafeArrayPutElement(psa, &ix, &var);

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



  try
  {
     ADOConnection1->OpenSchema(siPrimaryKeys , Array, EmptyParam,
(TADODataSet*)p_PKList);
  }
  catch(Exception &E)
  {
    MessageBox(NULL,

-- 
JOHN Z FIELDS
Technical Details
Message-ID: <4073f77d@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,5441336403a8b7e8,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2004-04-07 06:10:39 PST
Reply-To: "John Z Fields" <jfields@wrsystems.com>
From: "John Z Fields" <jfields@wrsystems.com>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: ADOConnection1->OpenSchema(siPrimaryKeys , Array, EmptyParam, (TADODataSet*)p_PKList);
Date: Wed, 7 Apr 2004 08:43:40 -0400
Lines: 69
Organization: WR Systems
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: 63.90.140.53
Message-ID: <4073f77d@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1081341821 63.90.140.53 (7 Apr 2004 05:43:41 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail