SQLMemTable: Embedded BDE Alternative
In-Memory SQL Database for Delphi / C++Builder



Opening and closing a table
Previous  Top  Next


Introduction

After
setting up SQLMemTable component and creating a table, just open the table to view and edit table's data in a data-aware control such as TDBGrid. There are two ways to open a table. You can set its Active property to True, or you can call its Open method. The following example shows how to use the Open method to open a table called 'customers' with a TSQLMemTable component called MySQLMemTable:

begin
// table settings
with MySQLMemTable do
begin
TableName:='customers';
ReadOnly:=False;
Open;
end;
end;

The ReadOnly property causes the current table with the name in the TableName property to be opened read-only, which means that the current application will be unable to modify the contents of the table until the table is closed and re-opened with write access (ReadOnly=False).

There are two ways to close a table. You can set its Active property to False, or you can call its Close method. Active controls associated with the table's data source are cleared.
The following example shows how to use the Close method to close a table with a TSQLMemTable component called MySQLMemTable:

begin
MySQLMemTable.Close;
end;

Important Note:
In-memory table is not deleted after closing table. You should call Table.DeleteTable for physical remove of the table data.




© AidAim Software SQLMemTable: