Mega Code Archive

 
Categories / Delphi / Examples
 

Easy way of creating a database application

How can you create a database application without manually putting the visual components like DBEdit, DBImage etc., and attach that with a field in the table and setting other properties? This article is intended for beginners. You don’t need to write a single line of code for this. All starts with the TTable component. Let me tell you the steps needed to do this: 1. Create a new application. 2. Put a TTable component on the form 3. Set the database and table name properties 4. Right click on the TTable component, you will be getting a menu 5. Select Fields editor 6. You will be getting a grid 7. Then right click on the fields Editor. 8. You will be getting another menu 9. Then you can either select the Add Fields or Add all fields option. 10. If you select Add all fields option, all the fields in the table will be added to the fields editor. 11. Then you just select the fields you want to show up on the form. 12. Then just drag all the fields on to the form; you are done. 13. Yes you will be getting the respective DBEdit,DBImage etc., on the form. 14. Also the datasource component will be added. 15. For navigation, you can put a Navigator control from the DataControls palette and assign the datasource property for it. 16. Now the simple database application is ready to use. 17. You can run the application and work with all the database operations like navigation, edit etc., thru the navigator. For Delphi beginners, this could be enough to start with database application. The same thing you can do with putting separate control like DBEdit etc., and setting the properties;but here you dont need to set any properties for those controls; all will be set automatically once you drag the fields from the fields editor onto the form. P.S.: Please dont forget to make the TTable's Active property to true. Enjoy!!!