V4RB - Retrieving Aggregate Function Values from Cursor
Ruslan Zasukhin
sunshine at public.kherson.ua
Mon May 19 10:00:57 CDT 2003
on 5/19/03 6:01 AM, Fitzbew at aol.com at Fitzbew at aol.com wrote:
Hi Fitzbew,
> I am having trouble retrieving a MIN() value from a cursor (using V4RB 1.9.7,
> RB 4.5.2).
>
> I have a String field in a database (I have verified the database values are
> correctly populated) that is populated with 'YYYY' values (1995, 1996...).
> Each value can occur multiple times. I am running this query:
>
> rstDB = dbAvx.SqlSelect("select DISTINCT Min(Date_from_YYYY) from
> mainrecords")
> (Excluding DISTINCT has no effect on the result.)
DISTINCT is not needed because Min returns one raw.
> The query returns a cursor with 1 record, however I have not been able to
> retrieve the field value.
>
> This is how it was suggested to me to retrieve the value from the recordset:
>
> varStr = rstDB.StringField(1).Value
>
> But using this method, varStr is not populated correctly. The resulting
> varType of the varStr variable is String(8), but it is zero-length. It is
> not Null.
>
> What am I doing wrong?
You mean varStr has type VARIANT ?
Try
dim vaStr as String.
All rest looks correct.
Hmm, please look into _TEST example in V4RB archive.
Find here tests on aggregate functions.
May be you will find difference.
--
Best regards,
Ruslan Zasukhin [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com
To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------
More information about the Valentina
mailing list