Third, the relationship between database components
The figure below illustrates the connection and relationship between database related components:
┌DBGRID
┌Table <= | ├dbtext
Database <= BDE <= │ | <= Datasource <= ├dbnavigator
└Query <= | ├dblistbox
└dbedit
↓ ↓ ↓
(Name of the component) Nameç ======= DataSet Name (component name)
(Set to true) ACTIVE (component name) Nameç == Datasource
(Database Both) DatabaseName
(Setting data sheet) TableName / SQL
Database BDE Engine Data Access Component (Capture) Visual Control (Display)
Note: "<=" represents the hierarchical relationship between components; "ç =" indicates the value of this attribute is the value of the attribute of the last layer;
"↓" indicates an important attribute of the layer component.
If you want to operate, we can complete a simple database program design on the form of Table / Query and DataSource on the form and place the visual components appropriately.
The alias of the database is an important concept that the above says. It is necessary to explain that, for Paradox, DBase these two original database types, DatabaseName only requires you to give the path to the database (of course You can also choose BDE alias, but few people will do such a stupid thing), which is really convenient to join up. If you want to access the SQL database, you must be an alias.
Said so long, ADE is so elegant, telling now to be a bit facilitated in the joint (join the DBASE series), have not seen anything more than ADO, is it a little name?
Is it convenient to establish a database application with the following method? After watching you :)
Fourth, create a database application with Database Desktop and Database Form Wizard (Database Form Wizard)
The elegance of BDE is that she can write a rich program, and from this point to see is ADO, it is like Russia is a poor country and China in the rich country. Like the rich country, even if the BDE has a problem, she is your lovers, but they are sorry for you, and Chinese men seem to like wild flowers :)
Here's explain how to use these two tools to create an app, you see that she is very convenient :)
Step 1: Create a database
First, we open (CREAT) Database Desktop, there are two ways, one is "Tools | Datase Desktop" Tools | Datase Desktop in C Builder "by" Start | Program | Borland C Builder6 | Datase Desktop "; ", Call out the database desktop tools as shown.
Second, the "File | New | Table" command in the menu is executed, and a new data sheet is created, as shown below:
Third, select the database type in the drop-down list in the pop-up Creat Table, after selecting, click the OK button in the Create Table dialog to complete the settings of the database type. Fourth, the above we choose FoxPro, and then the FoxPro Table dialog box will be called. Here you ask you to set the fields of the table and its property values.
Note: Due to an alias, the convenience of use and the special relationship with BCB, usually we choose not FoxPro, but Paradox and DBASE.
Of course, different types of this window is different. Here first, let's talk about the foxpro type.
Here you need to set up four attribute values: Field Name begins with letters, the length cannot exceed 10 characters, can be underlined in the middle, but there is no space; the field type (Type), you just click this item A group of attribute options is popped up; the field width (size) is used to set the field width of this field data. In FoxPro, there are several field widths that the system has set, the logical is 1, the date type is 8, note Type 10; the decimal number (DEC) is only valid when the data type is numerical.
We can also create an index for the table. Click "DEFINE INDEX" to pop up a dialog box.
Here, all the field names in the table are listed, select the field to set the index, click the arrow to the right to add to the right list so that the index is created. Click the OK button to pop up the "Save Index AS" dialog to allow the user to enter the name of the index.
Click the "Save AS" button to enter the table name in the saved dialog and select the alias and table name of the physical database managed by BDE.
Of course, you can also open an existing database table by clicking "Open | TABLE".
The following figure is the editing window of Paradox:
Be aware of the differences from above, its first index is defined in "*" in the "key" property you want to determine as the index. As for the establishment of the second index, don't want to say more here, you just pay attention to the drop box in the upper right corner, look at what she inside, it should be clear. Of course, some people will feel inconvenient to do not have a small number, saying some of the bad words of Paradox, in fact, PARADOX is the most powerful and convenient, as long as your data type is specified by the length, you are on the right Select "Validity Checks", you can edit the maximum, minimum, default, and data format written by the restriction field, now they are also in the form, just gray can't be used. (As for other contents will be explained in paradroles)
Why just say these two categories? Other classes are basically the same as they, you can use it.
Fifth, editing data in a database desktop tool, you can start your editing in the open data table (Of course you can also do it through "Table | Edit Date"). If you want to delete you, you will delete it. If you want to add you, you want to change you, but you should pay attention to it in editing.
Note: Press F9 to switch back and forth in two states of Edit Data and Browse Table (View Data), and run to another menu item, this must be noted, otherwise Sometimes I can edit the data you want to edit by pressing F9.
I have already hit so much, I can't stand it, I haven't worked, I have finished writing a database. Maybe it is awkward, there is no way, this is not from it, not to deliberately wasting system resources, please leave people under the mouth.