unit AdsBeispiel;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids,
DB, adsdata, adsfunc, adstable, adscnnct;
type
Tta =
class(TForm)
AdsConnection1: TAdsConnection;
AdsQuery1: TAdsQuery;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
ButtonSaveBm: TButton;
ButtonrestoreBm: TButton;
CheckBoxActive: TCheckBox;
CheckBoxUseBookMark: TCheckBox;
procedure FormCreate(Sender: TObject);
procedure CheckBoxActiveClick(Sender: TObject);
procedure ButtonrestoreBmClick(Sender: TObject);
procedure ButtonSaveBmClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
bm : TBookmark;
Id :
string;
end;
var
ta: Tta;
implementation
{$R *.dfm}
procedure Tta.ButtonSaveBmClick(Sender: TObject);
begin
bm := AdsQuery1.GetBookmark;
Id := AdsQuery1.FieldByName('
Id').AsString;
end;
procedure Tta.ButtonrestoreBmClick(Sender: TObject);
begin
if CheckBoxUseBookMark.Checked
then
begin
if AdsQuery1.BookmarkValid(Bm)
then
AdsQuery1.GotoBookmark(bm);
end
else
begin
if id <> '
'
then
AdsQuery1.Locate('
ID', Id, []);
end;
end;
procedure Tta.CheckBoxActiveClick(Sender: TObject);
begin
AdsQuery1.Active := TCheckBox(Sender).Checked;
end;
procedure Tta.FormCreate(Sender: TObject);
begin
AdsQuery1.Sql.Text := '
Select id, bkz, art, bezeich from bkz';
AdsQuery1.Active := true;
Id := '
';
end;
end.