Hi,
I used Delphi and I try Lazarus to create a program with database.
I create DBASE VII with this code :
begin
Source := ExtractFilePath(Application.Name);
MyDbf := TDbf.Create(nil);
if not DirectoryExists(Source + 'data') then
if not CreateDir(Source + 'data') then
raise Exception.Create('Impossible de créer le répertoire');
try
{ use relative path to "data" directory }
MyDbf.FilePath := 'data';
{ we want to use Visual dBase VII compatible tables }
MyDbf.TableLevel := 7;
MyDbf.Exclusive := True;
MyDbf.TableName := 'customers.dbf';
With MyDbf.FieldDefs do begin
Add('Id', ftAutoInc, 0, True);
Add('Name', ftString, 80, True);
End;
MyDbf.CreateTable;
MyDbf.Open;
MyDbf.AddIndex('custid', 'Id', [ixPrimary, ixUnique]);
{ add a secondary index }
MyDbf.AddIndex('custname','Name', [ixCaseInsensitive]);
finally
MyDbf.Free;
end;
With Delphi, To add something in the database, I used TTable but there's not TTable in Lazarus.
Can you give me a link to an exmaple of code with a database management.
Thanks
Lohot