Related Record Count Syntax Please

Chuck Pelto cbpelto at pcisys.net
Wed Dec 22 09:45:54 CST 2004


It's bad penny time, again....

For some reason, this code is not returning a valid cursor.

   tQuery = "SELECT * FROM Person, Task WHERE mPersonPtr = " + 
Str(currRecID)
   tCursor = mDataBase.SQLSelect(tQuery)

I'm getting "nil" for tCursor, as the second line is executed. The 
currRecID is valid. The tCursor is dim'd as a VCursor at the top of the 
method and is a property in Window 1 as well.

The syntax of the SQL query looks valid to me. The tutorial app 
developed up to this point works fine.

What could be causing this malfunction?

Regards,

Chuck


On Dec 21, 2004, at 10:49 AM, Ruslan Zasukhin wrote:

> On 12/21/04 7:40 PM, "Chuck Pelto" <cbpelto at pcisys.net> wrote:
>
>>> Just you can do this in a little simple way.
>>> Let you have some record in T1. You know its RecID.
>>>
>>> So you can do SQL quyry
>>>
>>>   curs = SELECT RecID FRON T2 WHERE Ptr = recid
>>>   res = curs.RecordCont
>>>
>>
>> Pursuing this activity I added three lines of code to Window 1's
>> PopulatePanes() method.
>>
>> dim tCursor as integer
>>
>> currRecID = mDataBase.mPerson.GetRecID() // get record ID for the
>> current parent record
>>
>> tCursor = SELECT * FROM Person, Task WHERE mPersonPtr = currRecID //
>> mPersonPtr is the field in the boTask that holds the pointer to the
>> related parent record in boPerson.
>>
>> I'm getting a syntax error on the last line.
>>
>> * Syntax error in Window1.PopulatePanes, line 24:
>> tCursor = SELECT * FROM Person, Task WHERE mPersonPtr = currRecID
>>
>> So what is wrong with this?
>
> Chuck,
>
> Argh. I did show just pseudo code. An idea.
>
> The correct code must be
>
>     query = " SELECT * FROM Person, Task WHERE mPersonPtr = "
>             + Str(currRecID)
>
>     tCursor = mDatabase.SqlSelect( query )
>
>
> -- 
> 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
> -------------------------------------------------------------
>
>
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
>


More information about the Valentina mailing list