Sign in Join
Wiki copytemporary

TSQLQuery

English · Français · Русский · 日本語

TSQLQuery is a fundamental database query component for use with any supported database. The component is found on SQLdb tab of the Component Palette.

Typical use of a TSQLQuery:

pascal
 SQLTransaction1.Database := SQLConnection1;
 SQLQuery1.Transaction := SQLTransaction1;
 DataSource1.DataSet := SQLQuery1;
 DBGrid1.DataSource := DataSource1;

Select

Select all columns from table somelist:

pascal
 SQLQuery1.SQL.Text := 'SELECT * FROM somelist';
 SQLQuery1.Open();

Insert

Insert a new record into table somelist:

pascal
 SQLQuery1.SQL.Text := 'INSERT INTO somelist (ItemNr,ItemCount) VALUES (1231,2)';
 SQLQuery1.ExecSQL();
 SQLTransaction1.Commit();

See also


From the Free Pascal wiki, page "TSQLQuery", as it stood on 2024-03-26 after a change by Ariben, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 2, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.