You must be logged in to post messages.
Please login or register

Age of Empires / Rise of Rome / Definitive Edition
Moderated by Suppiluliuma, PhatFish, Fisk, EpiC_Anonymous, Epd999

Hop to:    
Welcome! You are not logged in. Please Login or Register.5 replies
Age of Empires Heaven » Forums » Age of Empires / Rise of Rome / Definitive Edition » Delphi database programming walkthrough
Bottom
Topic Subject:Delphi database programming walkthrough
peter
HG Alumnus
posted 02-17-01 02:25 PM ET (US)         
1. Start Delphi
2. Select File|New application
3. Select Tools|Database Desktop
Change the working directory to your program folder.
4. Select File|New|Table
In the new table, define the fields you need for every record; you need one key field (likely to be a number). when you're ready with that, store the new table in your program folder (or somewhere else, but this is easier).
Quit the Database Desktop.
5. Add a Datasource and Table component to your form and components corresponding to the fields of your database (dbmemo for a memo, etc.). For each component corresponding to a field, set the DataSource property to Datasource1 (or whatever the Datasource component is called, then link it to the field (set the DataField property to the name of the field). For building your database you have to add an edit box to link to your key field as well. You can also add a navigation component. Linkt the table to yourn database by right clicking on it and selecting Explore, then select the database. You get an alias automatically.
6. Save the stuff.
7. Run the program and add records - don't forget to assign values to the key field or you get an error message. For saving a record, use the post method of the table component.
8. For viewing the database edit the main form. You might programmatically add the key field but I leave that to you.

Hope this helps

[This message has been edited by peter (edited 02-17-2001).]

AuthorReplies:
the_true_Augustus
Clubman
posted 02-17-01 02:35 PM ET (US)     1 / 5       
peter
HG Alumnus
posted 02-17-01 03:08 PM ET (US)     2 / 5       
What part of it?
If you have a memo field in the database, you need a dbmemo component for that. And for numeric fields you can use a dbedit. Try it - you'll see it's not so hard - it's just tricky

[This message has been edited by peter (edited 02-17-2001).]

the_true_Augustus
Clubman
posted 02-17-01 10:33 PM ET (US)     3 / 5       
I've never used the Database Desktop tool before.. it looks somewhat self explanitory. but could you tell me how to exactly use it correctly?
peter
HG Alumnus
posted 02-18-01 09:26 AM ET (US)     4 / 5       
It _is_ pretty self explanatory. The best reason for using it is just that. It provides a simple mechanism for defining the fields you want in your records and setting up rules for what fields have required content so you can't leave them blank.
When you're done with that the only pain is connecting your program to that database with an alias - the single worst thing in the whole affair. For that you can use explore on the pop up menu of the table component - double click on the yellow table image to get to the actual filename and it provides you with the alias automatically.
The reason for using data aware components is that they automatically load content from the database when you move to another record. No code required at all for navigating.
How much code do you need in VB?
peter
HG Alumnus
posted 02-21-01 02:37 PM ET (US)     5 / 5       
Hey Aug, how r u doing?
You must be logged in to post messages.
Please login or register

Hop to:    

Age of Empires Heaven | HeavenGames