Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use SQL in Grid ?
Message
From
06/10/1998 05:57:41
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
06/10/1998 00:32:34
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00143788
Message ID:
00144143
Views:
27
>>Suppose you have 3 textboxes (you have one) as txt1, txt2, txt3 referring to fields fld1, fld2, fld3 in your SQL :
Grid.init
>>with this
>>  .recordsourcetype = 4 && SQL
>>  .recordsource = "select * from mytable "+;
>>     "where fld1 = trim(thisform.txt1.value) " +;
>>     "and fld2 = trim(thisform.txt2.value) " +;
>>     "and fld3 = trim(thisform.txt3.value) " +;
>>     "into cursor grdCursor"
>>endwith
>>
>>* Lostfocus of textboxes
>>thisform.mygrid.refresh
Cetin
>
>
>Thanks for your suggestion. But I mean that I have set txtbox for my SQL condition. Example , if user input date=05/15/98 in txt1 . I would like my Grid refresh : Sele * from ...... where date >= txt1. Where I must store SQL command. At now I have store in form.load but it not effect my Grid.
>Thanks again.

Yes and I suggested just as you would do. Just like in example you could put the code in grid.init or directly write to grid's recordsource property at design time.
* PEM sheet design time
recordsource = "Sele * from ...... where date >= thisform.txt1.value into cursor grdCursor"
recordsourcetype = 4

* Or grid.init code
with this
  .recordsourcetype = 4 && SQL
  .recordsource = "Sele * from ...... where date >= thisform.txt1.value "+;
     "into cursor grdCursor"
endwith

* In either case txt1 lostfocus
thisform.mygrid.refresh
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform