Topic: TableGrid1 and EditBox1.Text

Hello MVD Users

I'm testing an SQL query in my application to test if it could short-circuit function CheckDublicate.

In a form I have a tablegrid displaying names of all authors stored in a table called Auteurs.
Above this grid, I put an EditText (with filter set to a%

My wish would be : when I begin to enter a letter, so focus is automatically placed upon first Occurence beginning with letter entered
(i.e when letter A is typed, focus is going on first author with first letter A and so one gradually as next letters are typed.

So here is my attempt to achieve this :

procedure Auteurs_Edit1_OnChange (Sender: string);
begin
   Auteurs.TableGrid1.SelectedRow := SQLExecute('SELECT * FROM Auteurs WHERE Auteur = ' + Auteurs.Edit1.Text + '%');
end;

Well, an error message rose singing : 'near "%" syntax error.

I probably made a mistake somewhere

Any idea about reason of such a message ?

Thanks for your help

JB

Re: TableGrid1 and EditBox1.Text

Hello Jean,
Perhaps I am misunderstanding but does something like the attached do what you want but without a script to perform the search? 
(I use the script only so the user can quickly focus on the first row in the tablegrid with a 'tab' key).
Maybe this helps?
Derek.

Post's attachments

Attachment icon jb authors.zip 336.55 kb, 569 downloads since 2016-05-19 

Re: TableGrid1 and EditBox1.Text

Hello Derek

It makes job and without script
Works fine
Thanks again
JB