Summary of SQL statement execution in Delphi

Source: Internet
Author: User

Use tquery:
query1.close;
query1. SQL. clear;
query1. SQL. add (insert into mytable values (1,23, AA);
query1.execsql;
for select statements, change query1.execsql to query1.open.
Use tadoquery as the same as above.
Use TADODataSet ( select only ):
adodataset1.close;
adodataset1.commandtext: = select * From mytable;
adodataset1.open;

 For I: = 0 to ds1.recordcount-1 do
Begin
Showmessage (Ds1.fieldvalues ['name']);
Ds1.next;
End;

Use tadocommand (Cannot select): 
Adocommand1.commandtext: = insert into mytable values (1, 23, AA );
Adocommand1.execute

 

How to dynamically create a table in Delphi

Use the adoquery Control
Connect to the database first
Adoquery1.close;
Adoquery1. SQL. Clear;
Adoquery1. SQL. Add ('create Table Name (student ID char (20), name char (20), Class char (20 ))');
Adoquery1.execsql;
Yes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.