unit13.pas

来自「简单的选课系统 采用delphi书写 包含简单的管理功能以及学生 教师 」· PAS 代码 · 共 73 行

PAS
73
字号
unit Unit13;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids, DBGrids;

type
  TForm13 = class(TForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    DBGrid1: TDBGrid;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form13: TForm13;
  pass:string;
implementation
uses unit6;
{$R *.dfm}

procedure TForm13.Button1Click(Sender: TObject);
begin
    with data.ADOQuery2 do
    begin
        close;
        sql.Clear;
        sql.Add('insert into 选课表');
        sql.Add('values ('''+Edit1.Text+''','''+pass+''')');
        execsql;
        with data.ADOQuery1 do
        begin
          close;
          sql.Clear;
          sql.Add('select * from 选课表');
          sql.Add('where 学生学号='''+pass+'''');
          execsql;
        end
    end
end;

procedure TForm13.Button2Click(Sender: TObject);
begin
    with data.ADOQuery2 do
    begin
        close;
        sql.Clear;
        sql.Add('delete from 选课表');
        sql.Add('where 课程号='''+edit1.Text+'''');
        execsql;
        with data.ADOQuery1 do
        begin
          close;
          sql.Clear;
          sql.Add('select * from 选课表');
          sql.Add('where 学生学号='''+pass+'''');
          execsql;
        end
    end
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?