📄 winform1.pas.~3~
字号:
unit WinForm1;
interface
uses
System.Drawing, System.Collections, System.ComponentModel,
System.Windows.Forms, System.Data, Borland.Data.Common, Borland.Data.Provider,
System.Globalization, System.Data.Common;
type
TWinForm2 = class(System.Windows.Forms.Form)
{$REGION 'Designer Managed Code'}
strict private
/// <summary>
/// Required designer variable.
/// </summary>
Components: System.ComponentModel.Container;
DataGrid1: System.Windows.Forms.DataGrid;
GroupBox2: System.Windows.Forms.GroupBox;
Button1: System.Windows.Forms.Button;
TextBox1: System.Windows.Forms.TextBox;
Label2: System.Windows.Forms.Label;
ComboBox1: System.Windows.Forms.ComboBox;
Label1: System.Windows.Forms.Label;
BdpConnection1: Borland.Data.Provider.BdpConnection;
BdpDataAdapter1: Borland.Data.Provider.BdpDataAdapter;
bdpSelectCommand1: Borland.Data.Provider.BdpCommand;
bdpInsertCommand1: Borland.Data.Provider.BdpCommand;
bdpUpdateCommand1: Borland.Data.Provider.BdpCommand;
bdpDeleteCommand1: Borland.Data.Provider.BdpCommand;
DataGridTableStyle1: System.Windows.Forms.DataGridTableStyle;
Column1: System.Windows.Forms.DataGridTextBoxColumn;
Column2: System.Windows.Forms.DataGridTextBoxColumn;
Column3: System.Windows.Forms.DataGridTextBoxColumn;
Column4: System.Windows.Forms.DataGridTextBoxColumn;
Column5: System.Windows.Forms.DataGridTextBoxColumn;
Column6: System.Windows.Forms.DataGridTextBoxColumn;
dataSet1: System.Data.DataSet;
DataTable1: System.Data.DataTable;
DataColumn1: System.Data.DataColumn;
DataColumn2: System.Data.DataColumn;
DataColumn3: System.Data.DataColumn;
DataColumn4: System.Data.DataColumn;
DataColumn5: System.Data.DataColumn;
DataColumn6: System.Data.DataColumn;
DataColumn7: System.Data.DataColumn;
DataColumn8: System.Data.DataColumn;
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
procedure InitializeComponent;
procedure QueryBtn_Click(sender: System.Object; e: System.EventArgs);
procedure TWinForm2_Load(sender: System.Object; e: System.EventArgs);
procedure ComboBox1_SelectedIndexChanged(sender: System.Object; e: System.EventArgs);
{$ENDREGION}
strict protected
/// <summary>
/// Clean up any resources being used.
/// </summary>
procedure Dispose(Disposing: Boolean); override;
private
{ Private Declarations }
SearchField : String;
public
constructor Create;
end;
[assembly: RuntimeRequiredAttribute(TypeOf(TWinForm2))]
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 TWinForm2.InitializeComponent;
type
TArrayOfSystem_Windows_Forms_DataGridTableStyle = array of System.Windows.Forms.DataGridTableStyle;
TArrayOfSystem_Windows_Forms_DataGridColumnStyle = array of System.Windows.Forms.DataGridColumnStyle;
TArrayOfSystem_Object = array of System.Object;
TArrayOfSystem_Data_Common_DataTableMapping = array of System.Data.Common.DataTableMapping;
TArrayOfSystem_Data_Common_DataColumnMapping = array of System.Data.Common.DataColumnMapping;
TArrayOfSystem_Data_DataTable = array of System.Data.DataTable;
TArrayOfSystem_Data_DataColumn = array of System.Data.DataColumn;
TArrayOfSystem_Data_Constraint = array of System.Data.Constraint;
TArrayOfString = array of string;
begin
Self.DataGrid1 := System.Windows.Forms.DataGrid.Create;
Self.DataGridTableStyle1 := System.Windows.Forms.DataGridTableStyle.Create;
Self.Column1 := System.Windows.Forms.DataGridTextBoxColumn.Create;
Self.Column2 := System.Windows.Forms.DataGridTextBoxColumn.Create;
Self.Column3 := System.Windows.Forms.DataGridTextBoxColumn.Create;
Self.Column4 := System.Windows.Forms.DataGridTextBoxColumn.Create;
Self.Column5 := System.Windows.Forms.DataGridTextBoxColumn.Create;
Self.Column6 := System.Windows.Forms.DataGridTextBoxColumn.Create;
Self.GroupBox2 := System.Windows.Forms.GroupBox.Create;
Self.Button1 := System.Windows.Forms.Button.Create;
Self.TextBox1 := System.Windows.Forms.TextBox.Create;
Self.Label2 := System.Windows.Forms.Label.Create;
Self.ComboBox1 := System.Windows.Forms.ComboBox.Create;
Self.Label1 := System.Windows.Forms.Label.Create;
Self.BdpConnection1 := Borland.Data.Provider.BdpConnection.Create;
Self.bdpSelectCommand1 := Borland.Data.Provider.BdpCommand.Create;
Self.bdpInsertCommand1 := Borland.Data.Provider.BdpCommand.Create;
Self.bdpUpdateCommand1 := Borland.Data.Provider.BdpCommand.Create;
Self.bdpDeleteCommand1 := Borland.Data.Provider.BdpCommand.Create;
Self.BdpDataAdapter1 := Borland.Data.Provider.BdpDataAdapter.Create;
Self.dataSet1 := System.Data.DataSet.Create;
Self.DataTable1 := System.Data.DataTable.Create;
Self.DataColumn1 := System.Data.DataColumn.Create;
Self.DataColumn2 := System.Data.DataColumn.Create;
Self.DataColumn3 := System.Data.DataColumn.Create;
Self.DataColumn4 := System.Data.DataColumn.Create;
Self.DataColumn5 := System.Data.DataColumn.Create;
Self.DataColumn6 := System.Data.DataColumn.Create;
Self.DataColumn7 := System.Data.DataColumn.Create;
Self.DataColumn8 := System.Data.DataColumn.Create;
(System.ComponentModel.ISupportInitialize(Self.DataGrid1)).BeginInit;
Self.GroupBox2.SuspendLayout;
(System.ComponentModel.ISupportInitialize(Self.BdpDataAdapter1)).BeginInit;
(System.ComponentModel.ISupportInitialize(Self.dataSet1)).BeginInit;
(System.ComponentModel.ISupportInitialize(Self.DataTable1)).BeginInit;
Self.SuspendLayout;
//
// DataGrid1
//
Self.DataGrid1.DataMember := 'Score';
Self.DataGrid1.DataSource := Self.dataSet1;
Self.DataGrid1.Dock := System.Windows.Forms.DockStyle.Bottom;
Self.DataGrid1.HeaderForeColor := System.Drawing.SystemColors.ControlText;
Self.DataGrid1.Location := System.Drawing.Point.Create(0, 63);
Self.DataGrid1.Name := 'DataGrid1';
Self.DataGrid1.Size := System.Drawing.Size.Create(413, 238);
Self.DataGrid1.TabIndex := 8;
Self.DataGrid1.TableStyles.AddRange(TArrayOfSystem_Windows_Forms_DataGridTableStyle.Create(Self.DataGridTableStyle1));
//
// DataGridTableStyle1
//
Self.DataGridTableStyle1.DataGrid := Self.DataGrid1;
Self.DataGridTableStyle1.GridColumnStyles.AddRange(TArrayOfSystem_Windows_Forms_DataGridColumnStyle.Create(Self.Column1,
Self.Column2, Self.Column3, Self.Column4, Self.Column5, Self.Column6));
Self.DataGridTableStyle1.HeaderForeColor := System.Drawing.SystemColors.ControlText;
Self.DataGridTableStyle1.MappingName := 'Score';
//
// Column1
//
Self.Column1.Format := '';
Self.Column1.FormatInfo := nil;
Self.Column1.HeaderText := '学号';
Self.Column1.MappingName := 'StudentID';
Self.Column1.Width := 75;
//
// Column2
//
Self.Column2.Format := '';
Self.Column2.FormatInfo := nil;
Self.Column2.HeaderText := '姓名';
Self.Column2.MappingName := 'StudentName';
Self.Column2.Width := 75;
//
// Column3
//
Self.Column3.Format := '';
Self.Column3.FormatInfo := nil;
Self.Column3.HeaderText := '班级';
Self.Column3.MappingName := 'Class';
Self.Column3.Width := 75;
//
// Column4
//
Self.Column4.Format := '';
Self.Column4.FormatInfo := nil;
Self.Column4.HeaderText := '课程号';
Self.Column4.MappingName := 'CourseID';
Self.Column4.Width := 75;
//
// Column5
//
Self.Column5.Format := '';
Self.Column5.FormatInfo := nil;
Self.Column5.HeaderText := '课程名称';
Self.Column5.MappingName := 'CourseName';
Self.Column5.Width := 75;
//
// Column6
//
Self.Column6.Format := '';
Self.Column6.FormatInfo := nil;
Self.Column6.HeaderText := '成绩';
Self.Column6.MappingName := 'Scores';
Self.Column6.Width := 75;
//
// GroupBox2
//
Self.GroupBox2.Controls.Add(Self.Button1);
Self.GroupBox2.Controls.Add(Self.TextBox1);
Self.GroupBox2.Controls.Add(Self.Label2);
Self.GroupBox2.Controls.Add(Self.ComboBox1);
Self.GroupBox2.Controls.Add(Self.Label1);
Self.GroupBox2.Dock := System.Windows.Forms.DockStyle.Top;
Self.GroupBox2.Location := System.Drawing.Point.Create(0, 0);
Self.GroupBox2.Name := 'GroupBox2';
Self.GroupBox2.Size := System.Drawing.Size.Create(413, 52);
Self.GroupBox2.TabIndex := 9;
Self.GroupBox2.TabStop := False;
Self.GroupBox2.Text := '查询条件';
//
// Button1
//
Self.Button1.Location := System.Drawing.Point.Create(327, 22);
Self.Button1.Name := 'Button1';
Self.Button1.Size := System.Drawing.Size.Create(62, 22);
Self.Button1.TabIndex := 9;
Self.Button1.Text := '查询';
Include(Self.Button1.Click, Self.QueryBtn_Click);
//
// TextBox1
//
Self.TextBox1.Location := System.Drawing.Point.Create(229, 23);
Self.TextBox1.Name := 'TextBox1';
Self.TextBox1.Size := System.Drawing.Size.Create(83, 20);
Self.TextBox1.TabIndex := 8;
Self.TextBox1.Text := '';
//
// Label2
//
Self.Label2.Location := System.Drawing.Point.Create(187, 22);
Self.Label2.Name := 'Label2';
Self.Label2.Size := System.Drawing.Size.Create(44, 22);
Self.Label2.TabIndex := 7;
Self.Label2.Text := '查询值';
//
// ComboBox1
//
Self.ComboBox1.Items.AddRange(TArrayOfSystem_Object.Create('学号', '学生姓名', '班' +
'级', '课程号', '课程名称'));
Self.ComboBox1.Location := System.Drawing.Point.Create(76, 23);
Self.ComboBox1.Name := 'ComboBox1';
Self.ComboBox1.Size := System.Drawing.Size.Create(101, 21);
Self.ComboBox1.TabIndex := 6;
Include(Self.ComboBox1.SelectedIndexChanged, Self.ComboBox1_SelectedIndexChanged);
//
// Label1
//
Self.Label1.Location := System.Drawing.Point.Create(20, 22);
Self.Label1.Name := 'Label1';
Self.Label1.Size := System.Drawing.Size.Create(47, 22);
Self.Label1.TabIndex := 5;
Self.Label1.Text := '查询字段';
//
// BdpConnection1
//
Self.BdpConnection1.ConnectionOptions := 'transaction isolation=ReadCommit' +
'ted;blobsize=1024';
Self.BdpConnection1.ConnectionString := 'assembly=Borland.Data.Msacc,Versi' +
'on=2.0.0.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b;vendorclient=m' +
'sjet40.dll;database=C:\Documents and Settings\David\Desktop\Delphi 8\BDP\' +
'studentdb.mdb;provider=MSAccess;username=Admin;password=';
//
// bdpSelectCommand1
//
Self.bdpSelectCommand1.CommandOptions := nil;
Self.bdpSelectCommand1.CommandText := 'SELECT Class, CourseID, CourseName,' +
' ID, Other, Scores, StudentID, StudentName FROM Score';
Self.bdpSelectCommand1.CommandType := System.Data.CommandType.Text;
Self.bdpSelectCommand1.Connection := Self.BdpConnection1;
Self.bdpSelectCommand1.ParameterCount := (SmallInt(0));
Self.bdpSelectCommand1.SchemaName := nil;
Self.bdpSelectCommand1.Transaction := nil;
Self.bdpSelectCommand1.UpdatedRowSource := System.Data.UpdateRowSource.None;
//
// bdpInsertCommand1
//
Self.bdpInsertCommand1.CommandOptions := nil;
Self.bdpInsertCommand1.CommandText := 'INSERT INTO Score (Class, CourseID,' +
' CourseName, Other, Scores, StudentID, StudentName ) VALUES ( ?, ?, ?, ?,' +
' ?, ?, ?)';
Self.bdpInsertCommand1.CommandType := System.Data.CommandType.Text;
Self.bdpInsertCommand1.Connection := Self.BdpConnection1;
Self.bdpInsertCommand1.ParameterCount := (SmallInt(7));
Self.bdpInsertCommand1.Parameters.Add(Borland.Data.Common.BdpParameter.Create('C' +
'lass', Borland.Data.Common.BdpType.&String, Borland.Data.Common.BdpType.Unknown,
0, System.Data.ParameterDirection.Input, False, (Byte(0)), (Byte(0)),
0, 'Class', System.Data.DataRowVersion.Current, nil));
Self.bdpInsertCommand1.Parameters.Add(Borland.Data.Common.BdpParameter.Create('C' +
'ourseID', Borland.Data.Common.BdpType.&String, Borland.Data.Common.BdpType.Unknown,
0, System.Data.ParameterDirection.Input, False, (Byte(0)), (Byte(0)),
0, 'CourseID', System.Data.DataRowVersion.Current, nil));
Self.bdpInsertCommand1.Parameters.Add(Borland.Data.Common.BdpParameter.Create('C' +
'ourseName', Borland.Data.Common.BdpType.&String, Borland.Data.Common.BdpType.Unknown,
0, System.Data.ParameterDirection.Input, False, (Byte(0)), (Byte(0)),
0, 'CourseName', System.Data.DataRowVersion.Current, nil));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -