Difference between revisions of "TSQLQuery"
From Free Pascal wiki
Jump to navigationJump to searchLine 6: | Line 6: | ||
DataSource1.DataSet := '''SQLQuery1'''; | DataSource1.DataSet := '''SQLQuery1'''; | ||
DBGrid1.DataSource := DataSource1; | DBGrid1.DataSource := DataSource1; | ||
+ | |||
+ | ===Insert=== | ||
+ | Insert a new record into table somelist: | ||
+ | <syntaxhighlight> | ||
+ | SQLQuery1.SQL.Text := 'INSERT INTO somelist (ItemNr,ItemCount) VALUES (1231,2)' | ||
+ | SQLQuery1.ExecSQL(); | ||
+ | SQLTransaction1.Commit(); | ||
+ | </syntaxhighlight> | ||
+ | |||
==See also== | ==See also== |
Revision as of 11:03, 5 August 2016
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:
SQLTransaction1.Database := SQLConnection1; SQLQuery1.Transaction := SQLTransaction1; DataSource1.DataSet := SQLQuery1; DBGrid1.DataSource := DataSource1;
Insert
Insert a new record into table somelist:
SQLQuery1.SQL.Text := 'INSERT INTO somelist (ItemNr,ItemCount) VALUES (1231,2)'
SQLQuery1.ExecSQL();
SQLTransaction1.Commit();
See also
- Working With TSQLQuery
- SqlDBHowto
- SQLdb_Tutorial1
- SQLdb_Tutorial2
- SQLdb_Tutorial3
- SQLdb_Tutorial4
- TSQLQuery doc
- Using SQLdb