1) Use the tools in delphi to establish the simplest database, and information sheet; explain, Database Desktop (DBD), index, query database tables, and access, edit data from each data, build customers below Data Table TBacustom (ScustNo, ScustName, Scustcorp, Scustaddr, ....) It is recommended to include string type, float type, date type, and Integer type four types.
2) Use SQL Explorer to set an alias, relational database, you can view the contents of information, and you can briefly introduce the simple usage of SQL Explorer tools, add information, modify information, delete information, ....
3) Using the association between the three controls of Delphi, DataSource, Table, DBGRID, to implement data display; TTable takes data in the database table, Ttable again "conversation with TDataSource", so that data browsing parts can Effectively access the data from the TTable and display and edit it. The TDataSource Parts communicates with the data browser TDBGRID, TDBEDIT. ==> TTABLE components ??????? Using the TTable component programming can even access the database without writing any procedures, the process of placing a TTable component in an application form is as follows: 1, Select the Data Access page on the component selection board; 2, click the Table icon; 3, click the mouse in the form to get a TTABLE component; 4. Attribute related to the TTable component setting: DatabaseName property Specifies the database you want to access. The path name, the path name can be represented by alias. The TABLENAME property specifies that the specific database table to access in the database. When the Active property is set to True, it means that the database table to be accessed is turned on; when setting to false, the database table to be accessed is not open. ==> TDATASOUECE Parts ?????? TDataSource Parts is a bridge, TTABLE, TDBEDIT, etc. connected to data set components, TTABLE, TDBEDIT, etc., TTABLE, TQUERY, TSTOREDPROC components can realize databases on disk via BDE Connect, but they cannot display data information in the database, and data control components such as TDBGRID, TDBEDIT, etc. can provide visual interface, display data information in the database, but they do not have the ability to access disk databases, is TDataSource The two are organically combined such that users can interact data information in the database, modify, insert, and delete. The process of placing the TDataSource component in the application form is as follows: 1. Select the Data Access page on the component selection board; 2. Click the DataSource icon; 3, click the mouse in the form, get a TDataSource Part; 4, for TDataSource Part Contection Related Attributes: DataSet Properties Specify a data set component, which can be the name of the TTable, TQuery, or TSTOREDPROC part. ==> DBGRID Set the DataSource attribute to display the purpose of displaying data;
4) Use Delphi's own data control components: TDBNAVigator uses the part to edit a single record, you can also use it to insert, delete records, and refresh display and cancel the previous operation
After the association, you can achieve new, modified, delete data. Let the new entry will practice more, very simple;
?
example:
Use Table, Data Source, DBGRID components to establish basic database
Component Property Property Value Description Table1Database NamedbDemos Set the profile source file file type Table NameCuontry.db Set the database file name ACTIVETRUE Start the database data (to set the first two properties, otherwise it will generate errors) Data Source1DataSetTable1 Database Source DBGRID1DATA SOURCEDASOSOURCE1 Set Source Table Components Table Components are used to connect to the database, and DBGRID is used to display the database information, but the two do not have a correlation, you have to communicate with Datasource to make DBGRID. The content of the database is displayed in the field format to the DatabaseName property set to DBDEMOS is the profile type of Borland's library file type for the file library source file.
Advanced Database: Use DbEdit, DBText, Dbmemo, Dbimage, four DataControls components
Form design
Component Property Property Value Description Table1 Database Name DBDemos Settings Database Source Unit file Type Table Name Animals.dbf Set Database Document Active True Start Database Data (Before you have the first two properties, you will generate errors) Data Source1 DataSet Table1 link database source DBGrid1 data source DataSource1 set the display source DBNarigAtor1 DataSource DataSource1 set data display source DBEdit1 DataSource DataSource1 set data display source DataField NAME filter information displayed field data DBText1 DataSource DataSource1 set the display source DataField AREA data filtering Displayed field data AutoSize True Automatically resizes DBMEMO1 DATASOURCE DATASOURCE1 Set Source DataField Area Filter Display Filter Data DBIMAGE1 DATASOURCE DATASOURCE1 Set Display Data Source DataField BMP Filter Display Image Source STERTCH TRUE Settings Image Automatic Filling Whole DBIMAGE1
DBMEMO and DBEDIT components can be used to set whether the user directly edits the content DBText, only the function of displaying
Database chart creates an additional button to [chart] to open a new form, change its title to [chart], add a dbchart to the new form to make charts, and put the align property of the DBCHART component The value is selected for [alclint] to join Unit2 in Unit2 Uses declaration to join Unit2 Uses Declaration to join Unit1 Edit Chart ??? In dbchart components, press the left mole to generate "editing dbchare1" dialog window ???? EDITING DBCHARE1 Dialog Window Press the [Add] button "Teechart Gally" window Select graphic style ???? Switch to [SRIES] main page Select [DataSource] secondary page Our data source is the database, so choose [Dateset] Item Selection [Dateset] Source is [form1.tab1] Specify the display name and the number of data fields ???? Lables: Select the field (tag) of the display information ???? Pie: Filter information field type State (value)