📄 unit4.pas
字号:
unit Unit4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, Grids, DBGrids, ADODB, ExtCtrls;
type
TForm1 = class(TForm)
ADOCommand1: TADOCommand;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
ADOQuery1: TADOQuery;
Panel1: TPanel;
procedure DBGrid1DblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.DBGrid1DblClick(Sender: TObject);
begin
if messageDLG('确认是否删除',mtconfirmation,[mbyes,mbno],0)=mrno then
exit;
with ADOCommand1 do
begin
commandtext:='delete from student where sno=:sno';
commandtype:=cmdtext;
parameters.ParamByName('sno').Value:=DBGrid1.Fields[0].AsString;
execute;
end;
with ADOQuery1 do
begin
close;
open;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -