Hallo,
innerhalb einer Datenbankanwendung benötige ich Zugriff auf Textdateien. Dazu habe ich einen Alias eingerichtet (Typ: Standard, DEFAULT DRIVER: ASCIIDRV, ENABLEBCD: FALSE).
Das Datenmodul der Anwendung enthält folgende Komponenten: 1 TDatabase, 1 TTable, 1 TDatasource.
Folgende Eigenschaften sind dabei gesetzt: Database1.AliasName auf den entsprechenden Aliasnamen, Database1.Connected:=false, Table1.DatabaseName auf Database1.DatabaseName, Table1.Active:=false,
Datasource1.DataSet auf Table1.
Die Textdatei (Testdaten.txt) besteht lediglich aus 4 Spalten mit Zahlen, die durch Kommata getrennt sind. Um die Daten in einem Grid anzuzeigen habe ich folgende Schemadatei (Testdaten.sch) erstellt:
[TESTDATEN]
FILETYPE=VARYING
CHARSET=ascii
DELIMITER="
SEPARATOR=,
Field1=Zahl1,FLOAT,20,04,00
Field2=Zahl2,FLOAT,20,04,00
Field3=Zahl3,FLOAT,20,04,00
Field4=Zahl4,FLOAT,20,04,00
Textdatei und Schemadatei befinden sich im gleichen Verzeichnis. Um dbUseSchemaFile auf true zu setzen verwende ich die DataModuleCreate-Prozedur des Datenmoduls:
procedure TDataModule2.DataModuleCreate(Sender: TObject);
begin
Database1.Connected:=true;
DbiSetProp(hDBIObj(Table1.Handle), dbUseSchemaFile, Longint(true));
Table1.Open;
end;
Nach Programmstart werden trotzdem alle vier Spalten der Textdatei in einer Spalte des Grids angezeigt. Warum ist dies so und wie lässt sich das abstellen?
Vielen Dank an alle die mir dabei helfen können,
Günter
innerhalb einer Datenbankanwendung benötige ich Zugriff auf Textdateien. Dazu habe ich einen Alias eingerichtet (Typ: Standard, DEFAULT DRIVER: ASCIIDRV, ENABLEBCD: FALSE).
Das Datenmodul der Anwendung enthält folgende Komponenten: 1 TDatabase, 1 TTable, 1 TDatasource.
Folgende Eigenschaften sind dabei gesetzt: Database1.AliasName auf den entsprechenden Aliasnamen, Database1.Connected:=false, Table1.DatabaseName auf Database1.DatabaseName, Table1.Active:=false,
Datasource1.DataSet auf Table1.
Die Textdatei (Testdaten.txt) besteht lediglich aus 4 Spalten mit Zahlen, die durch Kommata getrennt sind. Um die Daten in einem Grid anzuzeigen habe ich folgende Schemadatei (Testdaten.sch) erstellt:
[TESTDATEN]
FILETYPE=VARYING
CHARSET=ascii
DELIMITER="
SEPARATOR=,
Field1=Zahl1,FLOAT,20,04,00
Field2=Zahl2,FLOAT,20,04,00
Field3=Zahl3,FLOAT,20,04,00
Field4=Zahl4,FLOAT,20,04,00
Textdatei und Schemadatei befinden sich im gleichen Verzeichnis. Um dbUseSchemaFile auf true zu setzen verwende ich die DataModuleCreate-Prozedur des Datenmoduls:
procedure TDataModule2.DataModuleCreate(Sender: TObject);
begin
Database1.Connected:=true;
DbiSetProp(hDBIObj(Table1.Handle), dbUseSchemaFile, Longint(true));
Table1.Open;
end;
Nach Programmstart werden trotzdem alle vier Spalten der Textdatei in einer Spalte des Grids angezeigt. Warum ist dies so und wie lässt sich das abstellen?
Vielen Dank an alle die mir dabei helfen können,
Günter
Comment