Product Documentation

dbExpress Driver (dBX)

Previous Topic

Next Topic

Define

Define() establishes specific data definitions. This involves defining columns/fields and creating the tables/files with optional indexes.

Below is the code for Define():

procedure TForm1.Define;

begin

try

// start transaction

SQLConnection1.StartTransaction(td);

// create table

SQLConnection1.ExecuteDirect('CREATE TABLE custmast (' +

'cm_custnumb CHAR(4),' +

'cm_custzipc CHAR(9),' +

'cm_custstat CHAR(2),' +

'cm_custrtng CHAR(1),' +

'cm_custname VARCHAR(47),' +

'cm_custaddr VARCHAR(47),' +

'cm_custcity VARCHAR(47))');

// commit transaction

SQLConnection1.Commit(td);

except on E: Exception do Handle_Exception(E);

end;

end;

TOCIndex