Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to display an SQL result into a GRID?

Status
Not open for further replies.

mansii

Programmer
Oct 18, 2002
641
ID
Hi All!
I have a textbox in my form and put an SQL statement in it's interactiveChange Event. Now I want to put the result in the GRID.

Here's the statement:

select myCode ;
from zz_test ;
WHERE myCode LIKE ("%"+UPPER(ALLTRIM(Thisform.text1.text))+"%");
into cursor myCursor

Did I write it correctly? What must I do to put the result in the GRID? Thank's for any help.

Regards.
 
HI,

select myCode ;
from zz_test ;
WHERE myCode LIKE ("%"+UPPER(ALLTRIM(Thisform.text1.text))+"%");
into cursor myCursor


After that put
THISFORM.LOCKSCREEN = .T.
THISFORM.GRID1.RECORDSOURCE = "MYCURSOR"
THISFORM.LOCKSCREEN = .F.

The above results appear in grid but the width of the each column comes uneven and caption of each column of the grid will be same as field name of the cursor.

So it is advisable not to put your code in Interactive change event for proper view of the result in the grid.

suggestions Invited...


gchandrujs [sunshine]
 
Hi gchandrujs!

Thank's for your quick reply. It works!
The reason I put it in Interactive change event is that I am creating a kind of code search then displaying the description (memo field) of the matching records. Any suggestions?

Anyways, tx for your advice.
 
Ya, that i know why you gone to interactive change mode. Your approach is good but If it is List box no problem As you are using grid there will be delay in time.

Anyhow, you create a seperate method which contains the No. of Columns, column widths of the grid, Header captions etc., and in the Interactive change mode of your text box
you just call that new method.


Suggestions Invited...

gchandrujs [sunshine]
 
Tx gchandrujs!
I replaced the grid with a listbox. It runs smoother.

TIA.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top