Registriert seit: 15. Nov 2005
Ort: Uckerland
138 Beiträge
Delphi 7 Enterprise
|
Re: Einfache Datenbank mit libSQL
8. Jan 2008, 20:52
hier die komplette unit. bis zum showMessage(''); kommt er gar nicht.
Delphi-Quellcode:
unit uMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ZConnection, DB, ZAbstractRODataset, ZAbstractDataset, ZDataset,
ZAbstractTable;
type
TfrmMain = class(TForm)
ZConnection: TZConnection;
ZQuery: TZQuery;
ZTable: TZTable;
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
frmMain: TfrmMain;
implementation
{$R *.dfm}
procedure TfrmMain.FormCreate(Sender: TObject);
begin
with ZConnection do begin
Protocol := ' sqlite-3';
Database := ' database.db';
Connect;
end;
with ZQuery do begin
SQL.Add(' CREATE TABLE [tblTracks] (');
SQL.Add(' [ID] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,');
SQL.Add(' [Artist] VARCHAR(255) NULL,');
SQL.Add(' [Album] VARCHAR(255) NULL,');
SQL.Add(' [Track] INTEGER NULL,');
SQL.Add(' [Title] VARCHAR(255) NULL,');
SQL.Add(' );');
ExecSQL;
end;
showMessage(' ') ;
with ZTable do begin
TableName := ' tblTracks';
Active := true;
end;
end;
end.
marcel
Marcel
|
|
Zitat
|