Query in dbgrid Paradox 7 using Edit in Delphi

Asked

Viewed 577 times

1

I am very interested in learning programming in Delphi. I already know many things, but I still don’t know Database manipulation.
Good, without delay. I wanted to know how to query database Paradox 7 with Delphi using TEdit in the example below:

In my Form I have one TTable1, TDatasource1, TDbgrid1, TDbnavigator and a TEdit1. Everything is already properly connected to return on TDbgrid1 the values of TTable1.

What I really wanted was to type something in the text box and on the grid just show me what I typed or partial text in the field user database.

Example: I typed the word in the text box to and I want him to show only words that start with to without distinction of upper and lower case in the field user database. And also when I partially type the text it shows me the words that contain that partial text in the field user database.

I hope I have managed to explain my problem. Thanks in advance.

1 answer

1


In case what you really want to do, display the data on dbgrid?
As I understood want to do a query in the table (table1), in this case it is not possible to do, what can be done is a filter.
You know the basic SQL commands (select, from, Where )?
So for the filter the commands that are intended for WHERE can be placed in the filter, example, if you have a field in the table called CPF, you can put CPF='12345678912'.
Putting in your example:
Table1: NAME, CPF (must be populated)
Then write in Table1.Filter the expression CPF='12345678912' and change the item Table1.Filtered to TRUE, run the program, the result is a filter for in the table for the item, if it exists in the table it will display.
So if you put in Edit.Text this expression CPF='12345678912' and at the click of the button, the following command:

table1.Filtered := false;
table1.Filter   := Edit1.text;
table1.Filtred  := True;

You will get the result you want.

It helps you to get started?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.