V4RB Count Aggregate SQL problem

Ruslan Zasukhin sunshine at public.kherson.ua
Tue Feb 24 20:00:21 CST 2004


on 2/24/04 3:26 PM, Mike Albert at malbert at asia.apple.com wrote:

Hi Mike,

> I am having trouble getting the value of the aggregate count function from a
> cursor in RB.
> 
> The piece of code I am using is as follows :
> 
> theSQLSearch = "SELECT count(partno) FROM OrderTable where (countrycode='AUS')
> and snlengthmethod = 11 and serialno <> 'OEMRAM12345' and excluded = 0 and not
> (warrantytype = 'SVC DOA' or warrantytype = 'OOW') and ww = 21 and year =
> 2004"
> theTempCursor = vOrdersDataBase.SQLSelect( theSQLSearch, vDataBaseMode,
> kV_ReadOnly, kV_Random )
> vWWCountedParts = theTempCursor.ShortField(1).Value
> 
> I have tried ShortField, LongField, FloatField etc. to get the value returned
> in the cursor and it always crashes the RB IDE on the last line above...the
> cursor selected is fine.

TIP 1:

Count() -- return only positive integer numbers. Right?
So it must be not Long but Ulong.


TIP2:

Even if you cannot guess field type, you always can do code

    fld = c.Field(1)

    print fld.Type 

To see field type


> When I take the same select statement in ViSQL it works fine and returns the
> corect record count.
> 
> I must be missing something really obvious.  What should be the field type
> returned for a count.  The "partno" field is of type String(12).  I am using
> V4RB 1.10 and RB 4.5.3 on Mac OS X 10.3
> 
> Hoping you can provide some quick guidance.

-- 
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