Creating a data entry form

Creating a data editing form by hand is not to much complicated, as we already know. When developing database applications with Delphi (and ADO), most of the work is done inside the IDE by simply connecting various components together, thus having to write no code. A typical data browsing editing form presents a database table inside a DBGrid. Another way is to add several data aware controls to a form and link them to the data source. We'll place both a DBGrid and several data aware controls....

TField DefData Type

Obviously, data type that represents a string in Access is TEXT. In Paradox it's STRING. In order to port Paradox tables to Access we'll have to know what data types are available and what are their names. When working with the BDE and Paradox tables, the TFieldDef.DataType determines the type of a physical field in a (dataset) table. To successfully migrate Paradox tables to Access you need to have a function that transforms a Paradox field type to an Access type. The next function checks the...

Setting up Master Detail with ADOExpress

Creating a master-detail data form is not to much complicated. Have an empty Delphi form, and just follow the steps 1. Select the ADO page on the Component palette. Add two TADOTable components and one TADOConnection to a form. 2. Select the Data Access page on the Component palette. Add two TDataSource components to a form. 3. Select Data Controls page on the Component palette. Place two TDbGrid components on a form. Add two DBNavigator components, too. 4. Use the ADOConnection, the...

Compacting an Access database with ADO and Delphi DB Course Chapter

Chapter sixteen of the free Delphi Database Course for beginners. While working in a database application you change data in a database, the database becomes fragmented and uses more disk space than is necessary. Periodically, you can compact your database to defragment the database file. This article shows how to use JRO from Delphi in order to compact an Access database from code. While you add and delete records from database tables, your database becomes more and more fragmented and uses...

Connecting to a database Bde Ado Db

Chapter two of the free Delphi database online course. How to connect to an Access database - the UDL file Looking forward the smallest ADO example. As shown in the previous chapter of this course, a database is a collection of one or more tables that store data in a structured format. These tables, contain data that is represented by rows and fields. When a database consists of two or more tables, these tables generally contain separate yet related data. MS Access, Interbase or SQL Server use...

Add table create index set referential integrity

The next step is to create all tables three of them , add indexes, and create referential integrity. Even though we could use ADOX, that is, TADOXTable, TADOXKey, etc. I'm somehow more familiar with the standard DDL language and the TADOCommand component. Back in the chapter 11 of this course we discussed database tables porting issues. This time we'll create tables from nothing. The following peaces of code are to be placed inside the button's btnAddTables OnClick even handler, I'll slice the...

New Data Module

To create a data module at design time, choose File New Data Module. At design time, a data module looks like a standard Delphi form with a white background and no alignment grid. At run time data module exists only in memory. DataModule has only two properties, Name and Tag, and two events, OnCreate and OnDestroy. Use the Name property when referring to module's objects from other units. DataModules are not limited to data access components, they can also contain other nonvisual components,...

Data modifications DB

Chapter six of the free Delphi Database Course for beginners. Learn how to add, insert and delete records from a database The main goal of developing database applications is to provide a means of modifying the data. In the first five chapters this DB Course has shown how to connect to an Access database, how to display the data from a database table and how to navigate through the records in a table. In this sixth chapter of the free database course we'll see exactly how to add, edit and...

Tee Chart

The DBChart component is a powerful tool for creating database charts and graphs. It is not only powerful, but also complex. We wont be exploring all of its properties and methods, so you'll have to experiment with it to discover all that it is capable of and how it can best suite your needs. By using the DBChart with the TeeChart charting engine you can quickly make graphs directly for the data in datasets without requiring any code. TDBChart connects to any Delphi DataSource. ADO recordsets...

Filtered Filter Options Filter Group OnFilter Record

The Filtered property is a Boolean value True or False that determines if the string in the Filter property is used to filter the dataset. When Filtered is False, the filtering is ignored and the complete dataset is available to the application. The FilterOptions is a set of two values - both used when filtering string fields. If the foCaseInsensitive is included in the FilterOptions, comparison between the literal in the Filter property string and the field values are case-insensitive. The...

Data filtering DB

Chapter eight of the free Delphi Database Course for beginners. Using Filters to narow the scope of data that is presented to the user. As stated in one of the previous chapters, both TADOQuery and TADODatSet as dataset components share the same set of common methods and events. On of the features exposed by those datasets is the ability to narrow the scope of data that is presented to the user. Consider that you might have a database table with thousands of records, but your users are...

Pictures inside a database DB

Chapter three of the free Delphi database online course. Displaying images BMP, JPEG, inside an Access database with ADO and Delphi. These days developing database applications requires more than just operating with textual or numeric data. If you are, for example, developing an Internet intranet or multimedia based application, frequently there is a need to display pictures along with text from a database. In this third chapter of the Delphi database course, we'll see how to pull out and...

Microsofts Variant type

The first is how to handle Microsoft's VARIANT type. Delphi's equivalent is OLEVARIANT, though most programmers will be used to the native STRING, INTEGER and the like. Again this is something Delphi handles with ease with an array of functions such as VarCast. Below is an example of a function that allows us to cast variants into something easier to swallow function oleGetStr value oleVariant string var highVal integer oleArray PSafeArray oleObj oleVariant begin varError result IntToStr value...

Transactions in Delphi ADO database development DB Course Chapter

How many times have you wanted to insert, delete or update a lot of records collectively wanting that either all of them get executed or if there is an error then none is executed at all This article will show you how to post or undo a series of changes made to the source data in a single call. The general idea behind a transaction is that several steps can be performed in series, with the capability to undo all of the steps at once if needed. In addition, the transaction should happen inside...

This chapter of the free database course for Delphi beginners shows how to use JRO from Delphi in or

ADO does not directly expose a method for compacting a database. By using Jet and Replication Objects JRO , you can compact databases, refresh data from the cache, and create and maintain replicated databases. The JRO exposes two objects, the JetEngine object and the Replica object. The Replica object is used to manipulate replicated databases. We will not deal with database replications in this chapter. By using the Jet Engine object we can programmatically control compacting and refreshing...

Compact Delphi Project

Create a new Delphi application with one form. Add two Edit controls and a Button. From the ActiveX component page pick JetEngine. The first Edit should be renamed to edSource, the second one to edDest. The button should be renamed to btnComapct. The JetEngine should be renamed to JE. It should all look like The TJetEngine class has a CompactDatabase method. The method takes two parameters the ADO connection string for the source as well for the destination database....

Lock Type

The LockType property tells the provider what type of locks should be placed on records during editing. Locking can prevent one user from reading data that is being changed by another user, and it can prevent a user from changing data that is about to be changed by another user. Modifying a record in an Access database locks some neighboring records. This is because Access uses, so called, page locking strategy. This means that if a user is editing a record, some other user won't be allowed to...

Lookup with DBLookup ComboBox

Dblookupcombobox Delphi

As stated above, when your data entry form is made of more data controls DBEdit, DBComboBox, etc. it makes sense to just use DBLookupComboBox without creating a new field. For the start, use dragging from the Fields editor to add data controls to a form. Drag Name, Author, Type and Description. This will add 4 DBEdit components and 4 Label components. At this point, remove the DBEdit connected with the Author field of the Applications table and replace it with a DBLookupComboBox. Name it...