unit TischDatenbank;
interface
uses Classes, Controls, DBTables,
DB, DBCtrls, Dialogs, Graphics;
const DatenbankFile = '
Sensordatenbank.db';
Type TTischDatenbank =
class(TWinControl)
private
FTable: TTable;
FTBTableSensorname: TStringfield;
FTBVersuchstabelleSpleisspositionrechts: TFloatField;
FTBVersuchstabelleSpleisspositionlinks: TFloatField;
FTBVersuchstabelleMantellaenge: TFloatField;
FTBVersuchstabelleGap: TFloatField;
FTBVersuchstabelleManteldurchmesser: TFloatField;
FDataSource: TDataSource;
FDBNavigator: TDBNavigator;
FDBEdit: TDBEdit;
function CreateTable: TTable;
function CreateDataSource: TDataSource;
function createDBNavigator: TDBNavigator;
function createTDBEdit: TDBEdit;
protected
//procedure CreateWnd; override;
published
public
constructor create(AOwner: TComponent);
end;
implementation
constructor TTischDatenbank.create(AOwner: TComponent);
begin
inherited create(AOwner);
Controlstyle := Controlstyle - [csAcceptsControls];
Visible := true;
Color := clBlack;
Width := 300;
Height := 300;
FTable := CreateTable;
//FDataSource := CreateDataSource;
//FDBNavigator := CreateDBNavigator;
end;
function TTischDatenbank.CreateTable: TTable;
begin
result := TTable.Create(
nil);
result.TableName := DatenbankFile;
result.TableType := ttParadox;
if not result.Exists
then // <--- hier kommt der Fehler
begin
Showmessage('
Die Datenbankdatei "Sensorendaten.db" konnte nicht gefunden werden');
Enabled := false;
end
else result.Open;
{FTBTableSensorname := TStringField.create(nil);
result.Fields.Add(FTBTableSensorname);
{result.Fields.Add(FTBVersuchstabelleSpleisspositionrechts);
result.Fields.Add(FTBVersuchstabelleSpleisspositionlinks);
result.Fields.Add(FTBVersuchstabelleMantellaenge);
result.Fields.Add(FTBVersuchstabelleGap);
result.Fields.Add(FTBVersuchstabelleManteldurchmesser); }
//result.CreateTable;
end;
function TTischDatenbank.CreateDataSource: TDataSource;
begin
result := TDataSource.Create(
nil);
result.DataSet := FTable;
end;
function TTischDatenbank.createDBNavigator: TDBNavigator;
begin
result := TDBNavigator.Create(
nil);
result.Parent := Self;
result.DataSource := FDatasource;
result.Left := 10;
result.Top := 10;
result.Width := 200;
result.Height := 20;
end;
function TTischDatenbank.createTDBEdit: TDBEdit;
begin
result := TDBEdit.Create(
nil);
result.Parent := Self;
result.Enabled := true;
result.DataSource := FDataSource;
//result.DataSource.DataSet := FTable;
result.DataField := FTBTableSensorname.FieldName;
result.Left := 10;
result.Top := 50;
result.Width := 100;
result.Height := 20;
end;
{procedure TTischDatenBank.CreateWnd;
begin
//FDBEdit := CreateTDBEdit;
end;}
end.