1 (edited by tcoton 2015-08-20 14:50:18)

Topic: Get a value from table in textbox

Hi All,

I am trying to setup a parameter table so that the final user could change some values but I do not know how to display a value in a textbox coming from a table. I do not want to use a grid, just textboxes.

In current situation, I cannot update a unique value easily, it adds a row each time and I cannot display the value. I guess I would have to write a script...


http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&item=1275

Post's attachments

Attachment icon get value in textbox.png 27.96 kb, 320 downloads since 2015-08-20 

Re: Get a value from table in textbox

I could manage to do it using an example from another user who sent a project (License) using this feature, thanks to him.

just declaring the proper variable, assigning a sql query to this variable and then using caption did the trick:

procedure Form1_OnShow (Sender: string; Action: string);

begin 
var
q: string;

// Manage Parameters
q := SQLExecute('SELECT Quarantine FROM Parameters WHERE id=1');
Form1.Quarantine.Text:= q;
end;

To update the value, an update query on a button is sufficient smile

// Save parameters
 procedure Form1_save_quarant_OnClick (Sender: string; var Cancel: boolean);
begin
   SQLExecute ('REPLACE into Parameters (id,quarantine) VALUES (1, '+ Form1.Quarantine.sqlValue+')');

end;

Re: Get a value from table in textbox

This correct way )

Dmitry.