🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Locate and VarArrayCreate

#3220
From: Kim L. Utley
Date: Sat, 26 Oct 2002 16:47
38 lines
2094 bytes
Hello,

I figured out that when calling Locate() using a single key field you should
not create a Variant for the key value but simply pass the value itself
(e.g., TADOTable->Locate( "FieldName", "KeyValue", options ); ). However, I
would like to not have separate methods of calling Locate() depending on the
number of field names. Is there a way to accomplish this?

TIA,

Kim

> Hello,
>
> I'm getting an exception "Could not convert variant of type (Array
Variant)
> in type (String)" when the Locate() function is called. In my application
I
> need to dynamically create the field name(s) and key value(s) although in
my
> example I'm hard coding the data for testing. Most of the time they will
be
> strings but other data types will need to be used.
>
> Any help would be appreciated.
>
> TIA,
>
> Kim
>
>  int   bounds[2] = { 0, 1 };
>  Variant  keyVal = VarArrayCreate( bounds, 1, varVariant);
>
>  keyVal.PutElement( "01-01-0002", 0 );
>
>  bool success = adoTable->Locate( "AccountNumber", keyVal, opts );
>
>
Technical Details
Message-ID: <3dbac521@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!btnet-peer0!btnet-peer!btnet!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3db98cbe@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,880f9a9f70573d4a
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-10-26 09:46:06 PST
From: "Kim L. Utley" <kimutley@coserv.net>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3db98cbe@newsgroups.borland.com>
Subject: Re: Locate and VarArrayCreate
Date: Sat, 26 Oct 2002 11:47:13 -0500
Lines: 40
Organization: SIMS, Inc.
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
NNTP-Posting-Host: 63.151.196.45
Message-ID: <3dbac521@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1035650337 63.151.196.45 (26 Oct 2002 09:38:57 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!btnet-peer0!btnet-peer!btnet!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail