Delphi Getting Started 4 - Write the code connection database, easy to operate on the data, or a simple start

zhaozj2021-02-16  58

I am listed, just outline, the lecture personnel will play himself;

1) Create Table: Use TQuery to write SQL statement. Create a data sheet, of course, you can first build a directory, in fact, it is a database; running to see if it is successful;

2) Place some Label, Edit and a button (add) to achieve the function of adding a data, and use the TQuery write SQL statement to increase the contents of Edit.Text to the newly established data sheet; F9 looks ;

3) Put a TStringGrid and a button (Display) to implement the purpose of displaying data; use TQuery to write the SELECT statement to query out, then write a message to write to TSTRINGGRID, after doing it, F9 is trying;

4) Good to achieve the deleted function, add a DELETE button, then write the delete statement by tQuery;

5) If you can, query the data is displayed on the TStringGrid, you can implement a function, it is to point a row, while the data is displayed on the EDIT, you should write in the StringGrid event, this After the function is implemented, you can continue the following;

6) After the implementation of the function: Once you do, the information will be displayed on the Edit so we can modify the information, add a button update, and write the SQL statement with TQuery to update Edit.Text content to the information list. Display is displayed again, it will be displayed.

Slowly practice, a simple data sheet operation, in fact, it is also such a simple SQL statement;

转载请注明原文地址:https://www.9cbs.com/read-20386.html

New Post(0)