Order and save right now!
20% off with the 729824315 dicscount code for Ultimate Pack and any another product for Delphi from Greatis Programming! |
⤷ Create TTable without a form
Actually you don't need to use any visual component. Remember that each component in Delphi is an object and do not forget to free it for releasing of the allocated memory.
uses Db, DBTables, Dialogs
procedure TForm1.Button1Click(Sender: TObject);
var
Session: TSession;
Database: TDatabase;
Table: TTable;
begin
Session:=TSession.Create(nil);
Database:=TDatabase.Create(nil);
Session.SessionName:='DBSession';
Database.Connected:=False;
Database.AliasName:='dbdemos';
Database.DatabaseName:='biolife';
Database.SessionName:=Session.SessionName;
Table:=TTable.Create(nil);
Table.DatabaseName:=Database.DatabaseName;
Table.SessionName:=Session.SessionName;
Table.TableName:='biolife';
Table.Active:=True;
ShowMessage(Table.Fields[1].AsString+' '+Table.Fields[2].AsString);
Table.Free;
Database.Free;
Session.Free;
end;
-
More for developers