Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Filling a grid with output from SQL
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00326283
Message ID:
00326319
Views:
26
Hi Phil,

>>>Yesterday's lesson was great. I have the SQL statement written and it is pulling the proper records from the table into a cursor.
>>>
>>>I have a form with a text box (for the user to enter the search text), a grid, and a cmdbutton that runs the show.
>>>
>>>The user enters the search text, presses the button and I use this:
>>>
>>>
>>>l_cSearchtext='%'+upper(alltrim(ThisForm.txtSearchString.value))+'%'
>>>
>>>select * from document where title like l_cSearchtext order by number into cursor temp1
>>>
>>>to pull the appropriate records into the cursor temp1.
>>>
>>>Now I want the cursor data to be placed in the grid. The grid has its ColumnCount set to -1, the RecordSource to temp1 and the RecordSourceType to 4 - SQL Statement.
>>>
>>>After the SQL statement, I refresh the form, but get nothing in the grid....what (OBVIOUS THING) am I missing here?
>>>
>>>TIA!
>>
>>Hi Phil,
>>
>>Set the RecordSource of the grid to an empty string, perform the (new) SQL statement, then set the RecordSource back to the desired value. If you've set the ControlSource properties of individual columns, be certain to save, clear, and restore those as well.
>>
>>HTH.
>
>I tried your suggstion, but must be misunderstanding!
>
>cmdbutton.click is this:
>
>USE q:/qa/qdms2000/DOCUMENT/document share
>SET MESSAGE TO ""
>
>l_cSearchtext='%'+upper(alltrim(ThisForm.txtSearchString.value))+'%'
>
>select * from document where title like l_cSearchtext order by number into cursor temp1
>
ThisForm.grdOutput.recordsource=''

>ThisForm.grdOutput.recordsource='temp1'
>ThisForm.grdOutput.refresh
>thisform.refresh
>
>
>Mebbe one more clue??
>
And also make sure your temp1 contains records...
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform