Delphi -Database - Belgium Campus

6m ago
6 Views
1 Downloads
9.37 MB
20 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Azalea Piercy
Transcription

Delphi - Database V. Pretorius

Lesson objectives What is a database? Connecting Delphi and the database ADOtable Data Source DBGrid DGNavigator DBGrid vs. DBEdits Delphi & Database

The aim of this module: In some cases it is necessary for application software to keep a great deal of data, so that the user can manipulate the data. In such cases we will make use of Delphi in co-operation with a database. 90% of modern software uses some kind of stored data. Delphi has the capability to communicate with a database. Delphi can read data from the database, manipulate the data and even make changes to the data in the database. The database that we will use in conjunction with Delphi is: MICROSOFT ACCESS

What is the Database? A database is a collection of organised data. In a database the data is separated into fields and then related data can be normalized into different tables The different tables will then be connected through their relationship The database table looks like a matrix, we call the columns fields and the rows is records.

Work with the database through Delphi It is very important to keep the following in mind: We work with internal data (everything in Delphi) We work with external data (everything in the database) As with text files, it is very important to connect the internal and external data. To achieve this we make use of certain applications in the database and Delphi.

How to Connect the Database with Delphi Open a new application Do the following in this specific order and you will never have any trouble Put the following components on the new form: Table component Go to the ADO page on your component palette and seek for the ADO Table component

Change the ADOtable Properties Change the following properties in the OI: Name attribute: tblName (the name you want to use in your program) Connection string: Click on the ellipse next to the ConnectionString. Click on the BUILD button.

Change the ADOtable Properties Choose the Microsoft Jet 4.0 OLE DB Provider (for all the MS Office up to Office 2003) else choose the Microsoft Office 12.0 ACCESS Database Engine OLE DB Provider. Office 2003 Office 2007/2010 Click next

Change the ADOtable Properties Browse for the database that you will be using. Erase the path in front of the database name. Erase the username Un-tick the blank password Click the button Test Connection and the click OK

Change the ADOtable Properties Look for the name attribute in the ADO Table component’s properties in the OI. Click on the arrow next to it. Choose the table to which this table component should connect. Change the ‘Active’ attribute of the table to TRUE

Next Component: The Data Source You can get the Data Source component on the Data Access page on the component pallet.

Change the attributes of the Data Source Change the component Name to drsName (the name that you will use in your programming) Click on the arrow next to the Data-Set attribute Choose the table to which this component should connect.

Next Component: DBGrid You can get the DBGrid in the component pallet on the Data Controls page

Change the Attributes of the DBGrid Change the name attribute to dbgName (the name that you will use in your program). Click on the arrow next to the Data Source properties. Choose the Data Source that this component should connect to. You will see that the data from the database will show immediately in the dbGrid.

The Function of the Three Components DB Provider ADOTable Data Source Visual components: DBGrid DBEdit etc The Data Source is the connection between the visual components and the non-visual components.

DGNavigate – If necessary In some cases you need to navigate through the database data. You can then make use of the DBNavigate. This component is on the Data Controls page. Change the Name attribute to dbnName (the name that you will use in the program). Set the Data Source attribute to connect to the correct component.

DBNavigate Set the following attributes of the DBNavigator: Change the ConfirmDelete attribute to TRUE – we do this so that you will be asked to confirm if you want to permanently delete the record. The VisualButtons attribute will let you choose which of the buttons on the dbNavigate should be active. If you set the Show Hints attribute to TRUE it will show you a hint, about the component, when you move over the component with the mouse.

Understand the DBNavigate Last record First record Previous record Next record Add a record Refresh the data Delete record Cancel editing Post changes Save changes

DBGrid vs DBEdits In some cases you need to see only one record at a time, you will then make use of a dbEdit. All the dbEdits can be added at once: Double click on the ADOTable component, if you do not see the field names in the new window, you can right click and choose Add All Fields As soon as all the fields display you can again right click and choose Select All. Drag and drop the fields to your form You can place the dbEdits individually on the form. Just make sure, if you go this route that you set all the dbEdits’ Data Source attributes.

Be advised The dbNavigate component can be used with a dbGrid component The dbNavigate component can also be used with the dbEdits

make use of Delphi in co-operation with a database. 90% of modern software uses some kind of stored data. Delphi has the capability to communicate with a database. Delphi can read data from the database, manipulate the data and even make changes to the data in the database.

Related Documents:

1 1.0 Borland Delphi 1995-02-14 2 2.0 Borland Delphi 2 1996-02-10 3 3.0 Borland Delphi 3 1997-08-05 4 4.0 Borland Delphi 4 1998-07-17 5 5.0 Borland Delphi 5 1999-08-10 6 6,0 Borland Delphi 6 2001-05-21 7 7.0 Borland Delphi 7 2002-08-09 8 8.0 Borland Delphi 8 pour .NET 2003-12-22 2005 9.0 Borland Delphi 2005 2004-10-12 2006 10.0 Borland Delphi .

Migrating Borland Delphi applications to the Microsoft .NET Framework with Delphi 8 features and code constructs in Delphi 7 must be replaced by safe counterparts in Delphi for .NET. Many Delphi 7 language features are no longer available in the Delphi for .NET environment

The FTP Client Engine for Delphi component library supports and has been tested with all 32-bit and 64-bit versions of Delphi including: Borland Delphi (2.0, 3.0, 4.0, 5.0. 6.0 and 7.0) Borland Delphi 8 for .NET Borland Delphi 2005 & 2006 Borland Turbo Delphi

For Delphi Sydney and later it can be found in the Packages\Delphi\Delphi 10.4 directory. For earlier versions use the package in the Packages\Delphi\Delphi 10.3- directory. Note: The package is Design & Runtime together. P4D Components Component Functionality PythonEngine Load and connect to Python. Access to Python API (low-level .

For example buying Delphi XE 2 also gets you Delphi 7, Delphi 2007, Delphi 2009, Delphi 2010 and Delphi XE. Also the technology has changed so much during the last 10 years, and end users are no longer restricted to get ting the information through desktop applications, they use the

Kelebihan Borland Delphi 7.0 Borland delphi 7.0 merupakan pilihan bagi sebagian kalangan programmer untuk membuat aplikasi. Hal ini disebabkan kelebihan yang ada pada borland delphi 7.0 berikut ini beberapa kelebihan borlan delphi 7.0 antara lain : Berbasis Objek Orientid programming, seperti bagian yang ada pada program

The Delphi Connect smartphone app works on: Android 2.2 and later Apple iOS 5.0 and later The Delphi website at mycar.delphi.com works with: Internet Explorer 7 and later Google Chrome Apple Safari Firefox Note: Bluetooth features of this product are only available by using the Delphi Connect smartphone app.

from The Adventures of Tom Sawyer MARK TWAIN In this famous selection from The Adventures of Tom Sawyer (1876), written by Mark Twain (born Samuel Langhorne Clemens, 1835–1910), Tom, burdened with the chore to whitewash his Aunt Polly’s fence as punishment for his having played hooky from school, comes up with an ingenious way to get out of his work: He convinces his friends that it’s .