⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit4.pas

📁 一系列DELPHI的控件如何使用的例子,例子有的比较简单,但是能详细的说明了控件的使用,对许多刚涉足DELPHI的朋友会很有帮助的
💻 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 + -