Home arrow Delphi-Kylix arrow Page 3 - Saving Files to a Database using Delphi: Saving Bitmaps to a Database
DELPHI-KYLIX

Saving Files to a Database using Delphi: Saving Bitmaps to a Database


In this series of articles I will discuss how to save and retrieve images and binary files to and from a database and recognize the format by reading the first four bytes of blob data. As usual I am using Borland Developer Studio 2006 (Delphi 2006) as the development platform and for the database server I will use MS SQL Server 2000. I intend to start from scratch and demonstrate how easily and quickly a database application can be created in Delphi by using its Data Access and Data-Aware components.

Author Info:
By: Danish Ahmed
Rating: 5 stars5 stars5 stars5 stars5 stars / 7
June 26, 2007
TABLE OF CONTENTS:
  1. · Saving Files to a Database using Delphi: Saving Bitmaps to a Database
  2. · Create a new project
  3. · More components
  4. · Creating the application

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Saving Files to a Database using Delphi: Saving Bitmaps to a Database - More components
(Page 3 of 4 )

TADOTable TADOTable is defined as a table-type dataset for retrieving and operating on a recordset produced by a single database table. What are datasets then? Datasets are fundamental units for accessing data from the database. A dataset component represents a set of records which may belong to one particular table or be a result of a query or a stored procedure.

Since we need access to the records of only a single table I would employ the TADOTable component because it provides direct access to all the records of the specified table. The TADOTable component can directly connect to the database using its ConnectionString property but it is always advisable to use a single Connection object to connect to the database. Further, we would also need to set the TableName property of TADOTable to point to the actual table whose recordsets we want to access. The active property of the Table component determines whether the records are available for viewing or editing. To be able to view or edit them we would have to set the active property to true during design time and call the open method during runtime.

TDataSource A TDataSource component is an essential component in every database application and acts as an interface between the dataset and the data aware components. To display records, a data aware component's DataSource property should reference a dataset component which in turn should be linked to an active dataset.

TDBEdit A TDBEdit component is in many ways identical to the standard TEdit component but unlike TEdit, TDBEdit is a data aware component which means it can be linked to a text field in the database. It has a few additional properties including the DataSource property and the DataField property through which it is able to retrieve and post data to database.

TDBImage A TDBImage component is a visual data aware component that can be used to display graphical data from a BLOB field of the current dataset. Like all data aware component it needs to be linked to a DataSource and its DataField property should reference the Blob field in the database.

TDBNavigator TDBNavigator is a database component that provides easy navigation and manipulation of records in the dataset. In fact, it handles most of the database actions including navigating the records, inserting, editing, undoing after editing, refreshing and deleting records. The DBNavigator component uses a DataSource to link to the dataset and the values in the data-aware components can be viewed and manipulated through it. In short a DBNavigator allows you to add most of the basic database operation methods in response to user events without requiring you to write a single line of code.

The TButtonand TOpen Dialog components which I am using are standard controls and have been around for a long time, so I will just assume that you know about them and I will refrain from explaining them. The only thing worth noting is that Button1 is labeled "Load Image."


blog comments powered by Disqus
DELPHI-KYLIX ARTICLES

- Loading an XML Document into the DOM
- Delphi Wrapper Classes and XML
- Delphi and the DOM
- Delphi and XML
- Internet Access: Client Service
- Finishing the Client for an Internet Access ...
- The Client for an Internet Access Control Ap...
- User Management for an Internet Access Contr...
- Important Procedures for an Internet Access ...
- Server Code for an Internet Access Control A...
- Constructing the Interface for an Internet A...
- Building a Server Application for an Interne...
- Building an Internet Access Control Applicat...
- Client Dataset: Working with Data Packets an...
- Using the Client Dataset in an N-Tiered Appl...

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 9 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials