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

📄 modifystinfo.pas

📁 《Delphi 2005数据库系统开发与应用》源代码
💻 PAS
字号:
unit ModifyStInfo;

interface

uses
  System.Drawing, System.Collections, System.ComponentModel,
  System.Windows.Forms, System.Data, Borland.Data.Provider;

type
  FrmModifyStInfo = class(System.Windows.Forms.Form)
  {$REGION 'Designer Managed Code'}
  strict private
    /// <summary>
    /// Required designer variable.
    /// </summary>
    Components: System.ComponentModel.Container;
    Label1: System.Windows.Forms.Label;
    Label3: System.Windows.Forms.Label;
    Label5: System.Windows.Forms.Label;
    Label7: System.Windows.Forms.Label;
    Label9: System.Windows.Forms.Label;
    TxtStID: System.Windows.Forms.TextBox;
    ComboSex: System.Windows.Forms.ComboBox;
    TxtInDate: System.Windows.Forms.TextBox;
    TxtComment: System.Windows.Forms.TextBox;
    Label2: System.Windows.Forms.Label;
    Label4: System.Windows.Forms.Label;
    Label6: System.Windows.Forms.Label;
    Label8: System.Windows.Forms.Label;
    TxtName: System.Windows.Forms.TextBox;
    TxtBornDate: System.Windows.Forms.TextBox;
    TxtTel: System.Windows.Forms.TextBox;
    TxtAddress: System.Windows.Forms.TextBox;
    GroupBox1: System.Windows.Forms.GroupBox;
    GroupBox2: System.Windows.Forms.GroupBox;
    BtFirst: System.Windows.Forms.Button;
    BtPrev: System.Windows.Forms.Button;
    BtNext: System.Windows.Forms.Button;
    BtLast: System.Windows.Forms.Button;
    BtModify: System.Windows.Forms.Button;
    BtUpdate: System.Windows.Forms.Button;
    BtCancel: System.Windows.Forms.Button;
    BtDelete: System.Windows.Forms.Button;
    TxtClassNo: System.Windows.Forms.TextBox;
    BdpConnection1: Borland.Data.Provider.BdpConnection;
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    procedure InitializeComponent;
    procedure ShowData;
    procedure FrmModifyStInfo_Load(sender: System.Object; e: System.EventArgs);
    procedure BtNext_Click(sender: System.Object; e: System.EventArgs);
  {$ENDREGION}
  strict protected
    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    procedure Dispose(Disposing: Boolean); override;
  private
    myRow:DataRow;
    myTable:DataTable;
    rowNumber:Integer;
    { Private Declarations }
  public
    constructor Create;
  end;

  [assembly: RuntimeRequiredAttribute(TypeOf(FrmModifyStInfo))]

implementation

{$REGION 'Windows Form Designer generated code'}
/// <summary>
/// Required method for Designer support -- do not modify
/// the contents of this method with the code editor.
/// </summary>
procedure FrmModifyStInfo.InitializeComponent;
begin
  Self.Label1 := System.Windows.Forms.Label.Create;
  Self.Label3 := System.Windows.Forms.Label.Create;
  Self.Label5 := System.Windows.Forms.Label.Create;
  Self.Label7 := System.Windows.Forms.Label.Create;
  Self.Label9 := System.Windows.Forms.Label.Create;
  Self.TxtStID := System.Windows.Forms.TextBox.Create;
  Self.ComboSex := System.Windows.Forms.ComboBox.Create;
  Self.TxtInDate := System.Windows.Forms.TextBox.Create;
  Self.TxtComment := System.Windows.Forms.TextBox.Create;
  Self.Label2 := System.Windows.Forms.Label.Create;
  Self.Label4 := System.Windows.Forms.Label.Create;
  Self.Label6 := System.Windows.Forms.Label.Create;
  Self.Label8 := System.Windows.Forms.Label.Create;
  Self.TxtName := System.Windows.Forms.TextBox.Create;
  Self.TxtBornDate := System.Windows.Forms.TextBox.Create;
  Self.TxtTel := System.Windows.Forms.TextBox.Create;
  Self.TxtAddress := System.Windows.Forms.TextBox.Create;
  Self.GroupBox1 := System.Windows.Forms.GroupBox.Create;
  Self.BtLast := System.Windows.Forms.Button.Create;
  Self.BtNext := System.Windows.Forms.Button.Create;
  Self.BtPrev := System.Windows.Forms.Button.Create;
  Self.BtFirst := System.Windows.Forms.Button.Create;
  Self.GroupBox2 := System.Windows.Forms.GroupBox.Create;
  Self.BtDelete := System.Windows.Forms.Button.Create;
  Self.BtCancel := System.Windows.Forms.Button.Create;
  Self.BtUpdate := System.Windows.Forms.Button.Create;
  Self.BtModify := System.Windows.Forms.Button.Create;
  Self.TxtClassNo := System.Windows.Forms.TextBox.Create;
  Self.BdpConnection1 := Borland.Data.Provider.BdpConnection.Create;
  Self.GroupBox1.SuspendLayout;
  Self.GroupBox2.SuspendLayout;
  Self.SuspendLayout;
  // 
  // Label1
  // 
  Self.Label1.Location := System.Drawing.Point.Create(8, 16);
  Self.Label1.Name := 'Label1';
  Self.Label1.Size := System.Drawing.Size.Create(64, 23);
  Self.Label1.TabIndex := 1;
  Self.Label1.Text := '学号';
  Self.Label1.TextAlign := System.Drawing.ContentAlignment.MiddleCenter;
  // 
  // Label3
  // 
  Self.Label3.Location := System.Drawing.Point.Create(8, 48);
  Self.Label3.Name := 'Label3';
  Self.Label3.Size := System.Drawing.Size.Create(64, 23);
  Self.Label3.TabIndex := 5;
  Self.Label3.Text := '性别';
  Self.Label3.TextAlign := System.Drawing.ContentAlignment.MiddleCenter;
  // 
  // Label5
  // 
  Self.Label5.Location := System.Drawing.Point.Create(8, 80);
  Self.Label5.Name := 'Label5';
  Self.Label5.Size := System.Drawing.Size.Create(64, 23);
  Self.Label5.TabIndex := 9;
  Self.Label5.Text := '班级';
  Self.Label5.TextAlign := System.Drawing.ContentAlignment.MiddleCenter;
  // 
  // Label7
  // 
  Self.Label7.Location := System.Drawing.Point.Create(8, 112);
  Self.Label7.Name := 'Label7';
  Self.Label7.Size := System.Drawing.Size.Create(64, 23);
  Self.Label7.TabIndex := 14;
  Self.Label7.Text := '入校时间';
  Self.Label7.TextAlign := System.Drawing.ContentAlignment.MiddleLeft;
  // 
  // Label9
  // 
  Self.Label9.Location := System.Drawing.Point.Create(8, 144);
  Self.Label9.Name := 'Label9';
  Self.Label9.Size := System.Drawing.Size.Create(64, 23);
  Self.Label9.TabIndex := 18;
  Self.Label9.Text := '备注';
  Self.Label9.TextAlign := System.Drawing.ContentAlignment.MiddleCenter;
  // 
  // TxtStID
  // 
  Self.TxtStID.Location := System.Drawing.Point.Create(72, 16);
  Self.TxtStID.Name := 'TxtStID';
  Self.TxtStID.TabIndex := 19;
  Self.TxtStID.Text := '';
  // 
  // ComboSex
  // 
  Self.ComboSex.Location := System.Drawing.Point.Create(72, 48);
  Self.ComboSex.Name := 'ComboSex';
  Self.ComboSex.Size := System.Drawing.Size.Create(88, 20);
  Self.ComboSex.TabIndex := 20;
  // 
  // TxtInDate
  // 
  Self.TxtInDate.Location := System.Drawing.Point.Create(72, 112);
  Self.TxtInDate.Name := 'TxtInDate';
  Self.TxtInDate.TabIndex := 22;
  Self.TxtInDate.Text := '';
  // 
  // TxtComment
  // 
  Self.TxtComment.Location := System.Drawing.Point.Create(72, 144);
  Self.TxtComment.Name := 'TxtComment';
  Self.TxtComment.Size := System.Drawing.Size.Create(184, 21);
  Self.TxtComment.TabIndex := 23;
  Self.TxtComment.Text := '';
  // 
  // Label2
  // 
  Self.Label2.Location := System.Drawing.Point.Create(200, 16);
  Self.Label2.Name := 'Label2';
  Self.Label2.Size := System.Drawing.Size.Create(64, 23);
  Self.Label2.TabIndex := 24;
  Self.Label2.Text := '姓名';
  Self.Label2.TextAlign := System.Drawing.ContentAlignment.MiddleCenter;
  // 
  // Label4
  // 
  Self.Label4.Location := System.Drawing.Point.Create(200, 48);
  Self.Label4.Name := 'Label4';
  Self.Label4.Size := System.Drawing.Size.Create(64, 23);
  Self.Label4.TabIndex := 25;
  Self.Label4.Text := '出生日期';
  Self.Label4.TextAlign := System.Drawing.ContentAlignment.MiddleCenter;
  // 
  // Label6
  // 
  Self.Label6.Location := System.Drawing.Point.Create(200, 80);
  Self.Label6.Name := 'Label6';
  Self.Label6.Size := System.Drawing.Size.Create(64, 23);
  Self.Label6.TabIndex := 26;
  Self.Label6.Text := '联系电话';
  Self.Label6.TextAlign := System.Drawing.ContentAlignment.MiddleCenter;
  // 
  // Label8
  // 
  Self.Label8.Location := System.Drawing.Point.Create(200, 112);
  Self.Label8.Name := 'Label8';
  Self.Label8.Size := System.Drawing.Size.Create(64, 23);
  Self.Label8.TabIndex := 27;
  Self.Label8.Text := '家庭住址';
  Self.Label8.TextAlign := System.Drawing.ContentAlignment.MiddleCenter;
  // 
  // TxtName
  // 
  Self.TxtName.Location := System.Drawing.Point.Create(272, 16);
  Self.TxtName.Name := 'TxtName';
  Self.TxtName.TabIndex := 28;
  Self.TxtName.Text := '';
  // 
  // TxtBornDate
  // 
  Self.TxtBornDate.Location := System.Drawing.Point.Create(272, 48);
  Self.TxtBornDate.Name := 'TxtBornDate';
  Self.TxtBornDate.TabIndex := 29;
  Self.TxtBornDate.Text := '';
  // 
  // TxtTel
  // 
  Self.TxtTel.Location := System.Drawing.Point.Create(272, 80);
  Self.TxtTel.Name := 'TxtTel';
  Self.TxtTel.TabIndex := 30;
  Self.TxtTel.Text := '';
  // 
  // TxtAddress
  // 
  Self.TxtAddress.Location := System.Drawing.Point.Create(272, 112);
  Self.TxtAddress.Name := 'TxtAddress';
  Self.TxtAddress.TabIndex := 31;
  Self.TxtAddress.Text := '';
  // 
  // GroupBox1
  // 
  Self.GroupBox1.Controls.Add(Self.BtLast);
  Self.GroupBox1.Controls.Add(Self.BtNext);
  Self.GroupBox1.Controls.Add(Self.BtPrev);
  Self.GroupBox1.Controls.Add(Self.BtFirst);
  Self.GroupBox1.Location := System.Drawing.Point.Create(8, 176);
  Self.GroupBox1.Name := 'GroupBox1';
  Self.GroupBox1.Size := System.Drawing.Size.Create(384, 56);
  Self.GroupBox1.TabIndex := 32;
  Self.GroupBox1.TabStop := False;
  Self.GroupBox1.Text := '查看学籍信息';
  // 
  // BtLast
  // 
  Self.BtLast.Location := System.Drawing.Point.Create(296, 24);
  Self.BtLast.Name := 'BtLast';
  Self.BtLast.TabIndex := 3;
  Self.BtLast.Text := '最后一条记录';
  // 
  // BtNext
  // 
  Self.BtNext.Location := System.Drawing.Point.Create(200, 24);
  Self.BtNext.Name := 'BtNext';
  Self.BtNext.TabIndex := 2;
  Self.BtNext.Text := '下一条记录';
  Include(Self.BtNext.Click, Self.BtNext_Click);
  // 
  // BtPrev
  // 
  Self.BtPrev.Location := System.Drawing.Point.Create(104, 24);
  Self.BtPrev.Name := 'BtPrev';
  Self.BtPrev.TabIndex := 1;
  Self.BtPrev.Text := '上一条记录';
  // 
  // BtFirst
  // 
  Self.BtFirst.Location := System.Drawing.Point.Create(8, 24);
  Self.BtFirst.Name := 'BtFirst';
  Self.BtFirst.TabIndex := 0;
  Self.BtFirst.Text := '第一条记录';
  // 
  // GroupBox2
  // 
  Self.GroupBox2.Controls.Add(Self.BtDelete);
  Self.GroupBox2.Controls.Add(Self.BtCancel);
  Self.GroupBox2.Controls.Add(Self.BtUpdate);
  Self.GroupBox2.Controls.Add(Self.BtModify);
  Self.GroupBox2.Location := System.Drawing.Point.Create(8, 240);
  Self.GroupBox2.Name := 'GroupBox2';
  Self.GroupBox2.Size := System.Drawing.Size.Create(384, 56);
  Self.GroupBox2.TabIndex := 33;
  Self.GroupBox2.TabStop := False;
  Self.GroupBox2.Text := '修改学籍信息';
  // 
  // BtDelete
  // 
  Self.BtDelete.Location := System.Drawing.Point.Create(296, 24);
  Self.BtDelete.Name := 'BtDelete';
  Self.BtDelete.TabIndex := 4;
  Self.BtDelete.Text := '删除记录';
  // 
  // BtCancel
  // 
  Self.BtCancel.Location := System.Drawing.Point.Create(200, 24);
  Self.BtCancel.Name := 'BtCancel';
  Self.BtCancel.TabIndex := 3;
  Self.BtCancel.Text := '取消修改记录';
  // 
  // BtUpdate
  // 
  Self.BtUpdate.Location := System.Drawing.Point.Create(104, 24);
  Self.BtUpdate.Name := 'BtUpdate';
  Self.BtUpdate.TabIndex := 2;
  Self.BtUpdate.Text := '更新记录';
  // 
  // BtModify
  // 
  Self.BtModify.Location := System.Drawing.Point.Create(8, 24);
  Self.BtModify.Name := 'BtModify';
  Self.BtModify.TabIndex := 1;
  Self.BtModify.Text := '修改记录';
  // 
  // TxtClassNo
  // 
  Self.TxtClassNo.Location := System.Drawing.Point.Create(72, 80);
  Self.TxtClassNo.Name := 'TxtClassNo';
  Self.TxtClassNo.TabIndex := 34;
  Self.TxtClassNo.Text := '';
  // 
  // BdpConnection1
  // 
  Self.BdpConnection1.ConnectionOptions := 'transaction isolation=ReadCommitted;blob size=1024';
  Self.BdpConnection1.ConnectionString := 'assembly=Borland.Data.Mssql,Version=1.5.0.0,Culture=neutral,PublicKeyToken=91d6'+ 
  '2ebb5b0d1b1b;vendorclient=sqloledb.dll;database=教务信息管理系统;username=sa;hostname='+ 
  'storm;password=sa;provider=MSSQL';
  // 
  // FrmModifyStInfo
  // 
  Self.AutoScaleBaseSize := System.Drawing.Size.Create(6, 14);
  Self.ClientSize := System.Drawing.Size.Create(408, 310);
  Self.Controls.Add(Self.TxtClassNo);
  Self.Controls.Add(Self.GroupBox1);
  Self.Controls.Add(Self.TxtAddress);
  Self.Controls.Add(Self.TxtTel);
  Self.Controls.Add(Self.TxtBornDate);
  Self.Controls.Add(Self.TxtName);
  Self.Controls.Add(Self.Label8);
  Self.Controls.Add(Self.Label6);
  Self.Controls.Add(Self.Label4);
  Self.Controls.Add(Self.Label2);
  Self.Controls.Add(Self.TxtComment);
  Self.Controls.Add(Self.TxtInDate);
  Self.Controls.Add(Self.ComboSex);
  Self.Controls.Add(Self.TxtStID);
  Self.Controls.Add(Self.Label9);
  Self.Controls.Add(Self.Label7);
  Self.Controls.Add(Self.Label5);
  Self.Controls.Add(Self.Label3);
  Self.Controls.Add(Self.Label1);
  Self.Controls.Add(Self.GroupBox2);
  Self.Name := 'FrmModifyStInfo';
  Self.Text := '修改学籍信息';
  Include(Self.Load, Self.FrmModifyStInfo_Load);
  Self.GroupBox1.ResumeLayout(False);
  Self.GroupBox2.ResumeLayout(False);
  Self.ResumeLayout(False);
end;
{$ENDREGION}

procedure FrmModifyStInfo.Dispose(Disposing: Boolean);
begin
  if Disposing then
  begin
    if Components <> nil then
      Components.Dispose();
  end;
  inherited Dispose(Disposing);
end;

constructor FrmModifyStInfo.Create;
begin
  inherited Create;
  //
  // Required for Windows Form Designer support
  //
  InitializeComponent;
  //
  // TODO: Add any constructor code after InitializeComponent call
  //
end;

procedure FrmModifyStInfo.BtNext_Click(sender: System.Object; e: System.EventArgs);
var
cda:BdpDataAdapter;
slc:string;
newDataRow:DataRow;
cmdb:BdpCommandBuilder;
ds:DataSet;
myDataRow:DataRow;
begin
slc:='Select * From student_Info';
cda:=BdpDataAdapter.Create(slc,bdpConnection1);
ds:=DataSet.Create;
cda.Fill(ds);
myTable:=ds.Tables[0];
rowNumber:=rowNumber+1;
ShowData();

end;

procedure FrmModifyStInfo.FrmModifyStInfo_Load(sender: System.Object; e: System.EventArgs);
var
cda:BdpDataAdapter;
slc:string;
newDataRow:DataRow;
cmdb:BdpCommandBuilder;
ds:DataSet;
myDataRow:DataRow;
begin
slc:='Select * From student_Info';
cda:=BdpDataAdapter.Create(slc,bdpConnection1);
ds:=DataSet.Create;
cda.Fill(ds);
myTable:=ds.Tables[0];
rowNumber:=0;
ShowData();
end;

procedure FrmModifyStInfo.ShowData();
begin
myRow := myTable.Rows[rowNumber] ;
TxtStID.Text := myRow[0].ToString ;
TxtName.Text := myRow[1].ToString ;
ComboSex.Text := myRow[2].ToString ;
TxtBornDate.Text := myRow[3].ToString ;
TxtClassNo.Text := myRow[4].ToString ;
TxtTel.Text := myRow[5].ToString ;
TxtInDate.Text := myRow[6].ToString ;
TxtAddress.Text := myRow[7].ToString ;
TxtComment.Text := myRow[8].ToString ;
end;
end.

⌨️ 快捷键说明

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