Subject Re: Paremeter for SQL SELECT
From Mervyn Bick <invalid@invalid.invalid>
Date Sat, 28 Mar 2015 12:13:16 +0200
Newsgroups dbase.getting-started

On Sat, 28 Mar 2015 11:50:23 +0200, WJS <warrawarra@warra.com> wrote:


>>     function PUSHBUTTON1_onClick
>>        form.q = new Query()
>>        form.q.sql=[SELECT * FROM mbJob WHERE Id = "A"]
>>        form.q.requestLive := false
>>        form.q.active:=true
>>        form.grid2.datalink = form.q.rowset
>>        return
>>
>> https://www.dropbox.com/s/j874kds5tvt8249/q%20on%20form.jpg?dl=0
>>
>>
>>     function PUSHBUTTON1_onClick
>>        q = new Query()
>>        q.sql=[SELECT * FROM mbJob WHERE Id = "A"]
>>        q.requestLive := false
>>        q.active:=true
>>        form.grid2.datalink = q.rowset
>>        return
>>
>> https://www.dropbox.com/s/6ui9v3b6wmm49kq/q%20in%20variable.jpg?dl=0
>>
>> Mervyn.
> Hmmmm,
> I did not look at your form before but now did.
> I assume the second block of code should be for PUSHBUTTON2_onClick.
> Running this form in vers. 2.6.2, the PUSHBUTTON2_onClick works  
> perfectly. I do this many times in various apps and it always shows data  
> in the grid.
> Wian

Actually pushbutton2 in the example uses a parameter driven query.  Of the  
two examples above the first was from my working example.  I then did a  
global find & replace to change form.q to q to show what I found  
originally when I used Svatopluk's code.  The parameter driven query  
behaves in the same way.

I've just run the code in dBASE 2.8 (after fixing the constructor code  
syntax for the MBJOB1 query) and it gives the same outcome as in dBASE  
8.1.3.

Perhaps this behaviour is something that crept in after dBASE 2.6.2.


Mervyn.