H
hurryman
Unregistered / Unconfirmed
GUEST, unregistred user!
數据庫聞題,急
在用DATABASE与后台SQL SERVER連接,然后用query連接DATABASE.
我向query添加數据(緩沖區以打開),當我再次重run這個程序時,
我剛添加數据沒有了,后台也沒有.我不知道砸回事.我也沒用過BDE
procedure TForm3.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if utdata.DataModule1.Query1.State in [dsBrowse, dsEdit, dsInsert] then
begin
utdata.DataModule1.Query1.Close ;
utdata.DataModule1.Query1.Open;
end;
utdata.DataModule1.Query1.ApplyUpdates ;
utdata.DataModule1.Query1.Active :=false;
action :=cafree ;
end;
procedure TForm3.FormShow(Sender: TObject);
begin
dbedit1.SetFocus ;
if not utdata.DataModule1.Query1.Active then
utdata.DataModule1.Query1.Active :=true;
end;
procedure TForm3.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
begin
DBGrid1.Canvas.Font.Size :=10 ;
end;
procedure TForm3.DBNavigator1Click(Sender: TObject; Button: TNavigateBtn);
begin
case button of
nbInsert :begin
dbedit1.SetFocus ;
utdata.DataModule1.Query1.Append ;
end;
end;
end;
在用DATABASE与后台SQL SERVER連接,然后用query連接DATABASE.
我向query添加數据(緩沖區以打開),當我再次重run這個程序時,
我剛添加數据沒有了,后台也沒有.我不知道砸回事.我也沒用過BDE
procedure TForm3.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if utdata.DataModule1.Query1.State in [dsBrowse, dsEdit, dsInsert] then
begin
utdata.DataModule1.Query1.Close ;
utdata.DataModule1.Query1.Open;
end;
utdata.DataModule1.Query1.ApplyUpdates ;
utdata.DataModule1.Query1.Active :=false;
action :=cafree ;
end;
procedure TForm3.FormShow(Sender: TObject);
begin
dbedit1.SetFocus ;
if not utdata.DataModule1.Query1.Active then
utdata.DataModule1.Query1.Active :=true;
end;
procedure TForm3.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
begin
DBGrid1.Canvas.Font.Size :=10 ;
end;
procedure TForm3.DBNavigator1Click(Sender: TObject; Button: TNavigateBtn);
begin
case button of
nbInsert :begin
dbedit1.SetFocus ;
utdata.DataModule1.Query1.Append ;
end;
end;
end;