Sign in Join
Wiki copytemporary

TSQLQuery: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11**TSQLQuery** ![](/wiki-images/b/bb/Tsqlquery.png) is a fundamental database query component for use with any supported database. The component is found on [[SQLdb tab]] of the [[Component Palette]].
22
33Typical use of a TSQLQuery:
44
5-` SQLTransaction1.Database := SQLConnection1;`\
6-` SQLQuery1.Transaction := SQLTransaction1;`\
7-` DataSource1.DataSet := `**`SQLQuery1`**`;`\
8-` DBGrid1.DataSource := DataSource1;`
5+``` pascal
6+ SQLTransaction1.Database := SQLConnection1;
7+ SQLQuery1.Transaction := SQLTransaction1;
8+ DataSource1.DataSet := SQLQuery1;
9+ DBGrid1.DataSource := DataSource1;
10+```
911
1012### Select
1113
1214Select all columns from table somelist:
1315
1416``` pascal
1517 SQLQuery1.SQL.Text := 'SELECT * FROM somelist';
1618 SQLQuery1.Open();
1719```
1820
1921### Insert
2022
2123Insert a new record into table somelist:
2224
2325``` pascal
2426 SQLQuery1.SQL.Text := 'INSERT INTO somelist (ItemNr,ItemCount) VALUES (1231,2)';
2527 SQLQuery1.ExecSQL();
2628 SQLTransaction1.Commit();
2729```
2830
2931## See also
3032
3133- [TSQLQuery doc](http://www.freepascal.org/docs-html/fcl/sqldb/tsqlquery.html)
3234- [Using SQLdb](http://www.freepascal.org/docs-html/fcl/sqldb/usingsqldb.html)
3335
3436---
3537*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](/wiki-contact).*

Back to history