Site hosted by Angelfire.com: Build your free website today!

                                        This is a HELLO WORLD of Database. Using Lazarus .

 

This will be sample. So, we will use a local  Database .

An address book with a memo and image.

 

For you to create a database, easily. You need to know some terms. Why to use goolge.

 

Database

        A Database is an organized collection of  data. Like a address book. But when people use

        the term Database, they are almost always mean  database-management system (DBMS).

 

database-management system (DBMS)

        Is at lest a Database file, a form to enter the data, and a way to connect the form and Database

        file.

 

Flat File Database

        A flat file Database is a Dadabase that stores data in a plain text file. Each line of the text file  holds one record, with fields separated by delimiters, such as commas or tabs.

 

Local Database

 A local Database is a Database where the form to enter the data is on the same computer as the      

 Database file. It usually has one table and is usually  used by one person.  NOTE  usually.

 

 Client server Database

 The form that is used to enter the data is on one computer and the Database file(s) is on an

 other. These can get complicated fast.

 

Table    The rows, columns, and the data.

Field     A column and it's data.

Record        A row and it's data.

Item                One peace of data. Like first name.  

Cell                A single item in a gread.

Cursor         A pointer to the current record (row).

Dataset        The contents of a single Database table. (file).

Edit  User can edit items in a record. The record is not save until a post is preformed.

Insert     Add a new record.

Post                Saves the record.

                                                                     

                                             So lets start.

Start Lazarus on the top row of the IDE. Choose  Project → New Project and Application.

 

New stretch you form.  

 

 
 

.

.

 

In the Object Inspector.

 

 
 

Form1 → Under Properties tab → Caption type.  DBAddressBook Ver 1.0.1 Use version numbers.

1 = version, 0 = mayor revision, and 1 = miner revision.  

 

Save your project. Project → Save project as. Create a new folder DBAddressBook

and save the project.lpi as DBAddressBook.lpi and Unit1.pas as Unit1.pas. Save.

 

 

.

At the top of the IDE click the tab “Data Access” → Drop TdataSource on your form, anywhere.

In the “Data Controls” → TDBNavigator,  TDBGrid, 8 TDBEdit, TDBImage, and a TDBMemo on the form.

 

On the “Standard” tab drop 4 Tbuttons, and a TPanel.

On the “Additional” tab drop a Timge on the form.

And a rang them on the form. F12 when the “Source Editor” is in focus. Move the form to the top.

 

 

.

Click on Panel1 → Properties → Caption and delete Panel1.

Click on Panel1 → Properties → BorderStyle and from the dropdown → bsSingle.

Click on Panel1 → Properties → BorderWidth = 2.

In the OI window right click Panel1, from the dropdown  chouse Z-order → move to back.

.

In the OI window drag the DBImage1 under Panel1. Right click DBImage1,  from the dropdown  chouse Z-order → move to Front. Under the Properties tab → Align → alClient.  Properties tab → Stretch = True.

.

In the OI window drag the Image1 under Panel1. Right click Image1,  from the dropdown  chouse Z-order → move to Back. Under the Properties tab → Align → alClient. And Properties tab →Visible uncheck true. It is new false. Properties tab → Stretch = True.

 

 
 
 
 

.

 

Click on the DBNavigator1 . Properties tab → VisibleButtons  Click on the triangle.

 

Uncheck nbCancel, nbDelete, nbEdit, nbInsert, nbPost, and nbRefresh.

 

 

 

 

                           

 

 

 

 

 

 

Click on Button1. Properties tab →Caption = Add.

Click on Button2. Properties tab →Caption = Save.

Click on Button3. Properties tab →Caption = Delete.

Click on Button4. Properties tab →Caption = Exit.

 

Save project.

This is the end of the visual part.


...Part 2