1 (edited by alsu 2014-10-02 05:40:22)

Topic: save in to two tables from a single button

sir how to save text field and cmbobox into two difrrent database table with a single button 'save' ?  and how to show(edit form) this in a single form?   any script

Post's attachments

Attachment icon sample.zip 334.92 kb, 617 downloads since 2014-10-02 

Re: save in to two tables from a single button

Please, look this topic.
http://myvisualdatabase.com/forum/viewtopic.php?id=459

Dmitry.

Re: save in to two tables from a single button

sir i got two error messages
near "add syntax" error and near SQLExecute syntax error?


var
  sHello: string;

procedure frm2_Button1_OnClick (Sender: string; var Cancel: boolean);
begin

SQLExecute ('INSERT INTO main (jobno)  VALUES ("'+ frm2.Edit2.Text +'")');
SQLExecute ('INSERT INTO add (tag) VALUES ("' + frm2.Edit3.Text +'")');

end;

Re: save in to two tables from a single button

Because add is keyword of SQL, try this:

procedure frm2_Button1_OnClick (Sender: string; var Cancel: boolean);
begin

SQLExecute ('INSERT INTO main (jobno)  VALUES ("'+ frm2.Edit2.Text +'")');
SQLExecute ('INSERT INTO [add] (tag) VALUES ("' + frm2.Edit3.Text +'")');

end;
Dmitry.

5 (edited by alsu 2014-10-04 15:59:59)

Re: save in to two tables from a single button

sir i have one more doubt.  the above code put  in script page or choose sql query?  and how to show two database table datas in a single form?

Re: save in to two tables from a single button

This code for script page.


You can create event for form OnShow and read data from second database table using function SQLExecute and SQL query.

Dmitry.

Re: save in to two tables from a single button

sir any script for showing two database tabla data in a single form including combo box?

Re: save in to two tables from a single button

Please, send me your project with details, where you need that.
support@drive-software.com

Dmitry.