procedure TForm1.Button1Click(Sender: TObject);begin with ODBCConnection1 do begin Connected:= False; DatabaseName:='farmacia'; UserName:=''; //for MS SQL Server fill user and password Password:=''; Connected:= True; end; with SQLQuery1 do begin close;sql.clear; sql.add('select * from medimentos'); end; if SQLTransaction1.Active then SQLTransaction1.Commit; SQLTransaction1.StartTransaction; SQLQuery1.open;end;
Checkhttp://wiki.lazarus.freepascal.org/ODBCConnIn control Panel ODBC-> User DSN , add Access databaseCode: [Select]procedure TForm1.Button1Click(Sender: TObject);begin with ODBCConnection1 do begin Connected:= False; DatabaseName:='farmacia'; UserName:=''; //for MS SQL Server fill user and password Password:=''; Connected:= True; end; with SQLQuery1 do begin close;sql.clear; sql.add('select * from medimentos'); end; if SQLTransaction1.Active then SQLTransaction1.Commit; SQLTransaction1.StartTransaction; SQLQuery1.open;end; Checkhttp://wiki.lazarus.freepascal.org/Databaseshere an Database example with Firebird and SQLDbhttp://www.lazarus.freepascal.org/index.php/topic,7246.msg34315.html#msg34315