this example works great under winblowz but not under linux
procedure TMKB.Button1Click(Sender: TObject);
var
S: String;
conn: TODBCConnection;
query: TSQLQuery;
transaction: TSQLTransaction;
begin
conn := TODBCCOnnection.Create(nil);
query := TSQLQuery.Create(nil);
transaction := TSQLTransaction.Create(nil);
try
try
// conn.HostName := '127.0.0.1';
// conn.DatabaseName := 'diary'; {replace this with the name of your database}
conn.Transaction := transaction;
// conn.UserName:= '';
// conn.Password:= '';
// for winblowz
conn.Params.Add ('DBQ=C:\Lazarus-Pascal\odbc-example\dg.mdb');
conn.Driver := 'Microsoft Access Driver (*.mdb)';
query.DataBase := conn;
query.UsePrimaryKeyAsKey:=false;
query.SQL.Text := 'SELECT * FROM dg';
query.Open;
S := '';
while not query.EOF do
begin
S := S + query.FieldByName('sifra').AsString + #13#10;
query.Next;
end;
finally
query.Free;
conn.Free;
end;
except
on E: Exception do
ShowMessage(E.message);
end;
Memo1.Text:= S;
end;
I only change some things in this example. Orig example is on wiki (i don't have url now...search for it)
btw can somebody tell me why this example fails on linux (i changed the path to db file)?