📄 selclass.pas.~1~
字号:
unit SelClass;
interface
uses
System.Drawing, System.Collections, System.ComponentModel,
System.Windows.Forms, System.Data, Borland.Data.Common, Borland.Data.Provider,
System.Globalization, dsAdminUnit;
type
frmSelClass = class(System.Windows.Forms.Form)
{$REGION 'Designer Managed Code'}
strict private
/// <summary>
/// Required designer variable.
/// </summary>
Components: System.ComponentModel.Container;
cbClsName: System.Windows.Forms.ComboBox;
cbDepName: System.Windows.Forms.ComboBox;
BdpConnection1: Borland.Data.Provider.BdpConnection;
daCls: Borland.Data.Provider.BdpDataAdapter;
bdpSelectCommand1: Borland.Data.Provider.BdpCommand;
bdpInsertCommand1: Borland.Data.Provider.BdpCommand;
bdpUpdateCommand1: Borland.Data.Provider.BdpCommand;
bdpDeleteCommand1: Borland.Data.Provider.BdpCommand;
daDep: Borland.Data.Provider.BdpDataAdapter;
bdpSelectCommand2: Borland.Data.Provider.BdpCommand;
bdpInsertCommand2: Borland.Data.Provider.BdpCommand;
bdpUpdateCommand2: Borland.Data.Provider.BdpCommand;
bdpDeleteCommand2: Borland.Data.Provider.BdpCommand;
dsAdmin1: dsAdminUnit.dsAdmin;
btnOK: System.Windows.Forms.Button;
btnCancel: System.Windows.Forms.Button;
Label1: System.Windows.Forms.Label;
Label2: System.Windows.Forms.Label;
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
procedure InitializeComponent;
procedure frmSelClass_Load(sender: System.Object; e: System.EventArgs);
procedure btnOK_Click(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 }
procedure AdminSetRelation;
public
ReturnValue:string;
constructor Create;
end;
[assembly: RuntimeRequiredAttribute(TypeOf(frmSelClass))]
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 frmSelClass.InitializeComponent;
begin
Self.cbClsName := System.Windows.Forms.ComboBox.Create;
Self.cbDepName := System.Windows.Forms.ComboBox.Create;
Self.BdpConnection1 := Borland.Data.Provider.BdpConnection.Create;
Self.daCls := Borland.Data.Provider.BdpDataAdapter.Create;
Self.bdpDeleteCommand1 := Borland.Data.Provider.BdpCommand.Create;
Self.bdpInsertCommand1 := Borland.Data.Provider.BdpCommand.Create;
Self.bdpSelectCommand1 := Borland.Data.Provider.BdpCommand.Create;
Self.bdpUpdateCommand1 := Borland.Data.Provider.BdpCommand.Create;
Self.daDep := Borland.Data.Provider.BdpDataAdapter.Create;
Self.bdpDeleteCommand2 := Borland.Data.Provider.BdpCommand.Create;
Self.bdpInsertCommand2 := Borland.Data.Provider.BdpCommand.Create;
Self.bdpSelectCommand2 := Borland.Data.Provider.BdpCommand.Create;
Self.bdpUpdateCommand2 := Borland.Data.Provider.BdpCommand.Create;
Self.dsAdmin1 := dsAdminUnit.dsAdmin.Create;
Self.btnOK := System.Windows.Forms.Button.Create;
Self.btnCancel := System.Windows.Forms.Button.Create;
Self.Label1 := System.Windows.Forms.Label.Create;
Self.Label2 := System.Windows.Forms.Label.Create;
(System.ComponentModel.ISupportInitialize(Self.daCls)).BeginInit;
(System.ComponentModel.ISupportInitialize(Self.daDep)).BeginInit;
(System.ComponentModel.ISupportInitialize(Self.dsAdmin1)).BeginInit;
Self.SuspendLayout;
//
// cbClsName
//
Self.cbClsName.DropDownStyle := System.Windows.Forms.ComboBoxStyle.DropDownList;
Self.cbClsName.Location := System.Drawing.Point.Create(24, 104);
Self.cbClsName.Name := 'cbClsName';
Self.cbClsName.Size := System.Drawing.Size.Create(208, 20);
Self.cbClsName.TabIndex := 9;
//
// cbDepName
//
Self.cbDepName.DropDownStyle := System.Windows.Forms.ComboBoxStyle.DropDownList;
Self.cbDepName.Location := System.Drawing.Point.Create(24, 40);
Self.cbDepName.Name := 'cbDepName';
Self.cbDepName.Size := System.Drawing.Size.Create(208, 20);
Self.cbDepName.TabIndex := 8;
//
// 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=9'+
'1d62ebb5b0d1b1b;vendorclient=sqloledb.dll;database=StuManage;username=sa;hostn'+
'ame=localhost;password=;provider=MSSQL';
//
// daCls
//
Self.daCls.Active := False;
Self.daCls.DataSet := nil;
Self.daCls.DataTable := nil;
Self.daCls.DeleteCommand := Self.bdpDeleteCommand1;
Self.daCls.InsertCommand := Self.bdpInsertCommand1;
Self.daCls.SelectCommand := Self.bdpSelectCommand1;
Self.daCls.StartRecord := 0;
Self.daCls.UpdateCommand := Self.bdpUpdateCommand1;
//
// bdpDeleteCommand1
//
Self.bdpDeleteCommand1.CommandOptions := nil;
Self.bdpDeleteCommand1.CommandText := 'DELETE FROM dbo.Class WHERE ID = ? AND DepID = ? AND Subject = ?';
Self.bdpDeleteCommand1.CommandType := System.Data.CommandType.Text;
Self.bdpDeleteCommand1.Connection := Self.BdpConnection1;
Self.bdpDeleteCommand1.ParameterCount := (SmallInt(3));
Self.bdpDeleteCommand1.Parameters.Add(Borland.Data.Common.BdpParameter.Create('IDOriginal',
Borland.Data.Common.BdpType.&String, Borland.Data.Common.BdpType.stFixed,
6, System.Data.ParameterDirection.Input, False,
(Byte(0)), (Byte(0)), 0, 'ID', System.Data.DataRowVersion.Original,
nil));
Self.bdpDeleteCommand1.Parameters.Add(Borland.Data.Common.BdpParameter.Create('DepIDOriginal',
Borland.Data.Common.BdpType.&String, Borland.Data.Common.BdpType.stFixed,
2, System.Data.ParameterDirection.Input, False,
(Byte(0)), (Byte(0)), 0, 'DepID', System.Data.DataRowVersion.Original,
nil));
Self.bdpDeleteCommand1.Parameters.Add(Borland.Data.Common.BdpParameter.Create('SubjectOriginal',
Borland.Data.Common.BdpType.&String, Borland.Data.Common.BdpType.stFixed,
20, System.Data.ParameterDirection.Input, False,
(Byte(0)), (Byte(0)), 0, 'Subject', System.Data.DataRowVersion.Original,
nil));
Self.bdpDeleteCommand1.SchemaName := nil;
Self.bdpDeleteCommand1.Transaction := nil;
Self.bdpDeleteCommand1.UpdatedRowSource := System.Data.UpdateRowSource.None;
//
// bdpInsertCommand1
//
Self.bdpInsertCommand1.CommandOptions := nil;
Self.bdpInsertCommand1.CommandText := 'INSERT INTO dbo.Class (ID, DepID, Subject ) VALUES ( ?, ?, ?)';
Self.bdpInsertCommand1.CommandType := System.Data.CommandType.Text;
Self.bdpInsertCommand1.Connection := Self.BdpConnection1;
Self.bdpInsertCommand1.ParameterCount := (SmallInt(3));
Self.bdpInsertCommand1.Parameters.Add(Borland.Data.Common.BdpParameter.Create('ID',
Borland.Data.Common.BdpType.&String, Borland.Data.Common.BdpType.stFixed,
6, System.Data.ParameterDirection.Input, False,
(Byte(0)), (Byte(0)), 0, 'ID', System.Data.DataRowVersion.Current,
nil));
Self.bdpInsertCommand1.Parameters.Add(Borland.Data.Common.BdpParameter.Create('DepID',
Borland.Data.Common.BdpType.&String, Borland.Data.Common.BdpType.stFixed,
2, System.Data.ParameterDirection.Input, False,
(Byte(0)), (Byte(0)), 0, 'DepID', System.Data.DataRowVersion.Current,
nil));
Self.bdpInsertCommand1.Parameters.Add(Borland.Data.Common.BdpParameter.Create('Subject',
Borland.Data.Common.BdpType.&String, Borland.Data.Common.BdpType.stFixed,
20, System.Data.ParameterDirection.Input, False,
(Byte(0)), (Byte(0)), 0, 'Subject', System.Data.DataRowVersion.Current,
nil));
Self.bdpInsertCommand1.SchemaName := nil;
Self.bdpInsertCommand1.Transaction := nil;
Self.bdpInsertCommand1.UpdatedRowSource := System.Data.UpdateRowSource.None;
//
// bdpSelectCommand1
//
Self.bdpSelectCommand1.CommandOptions := nil;
Self.bdpSelectCommand1.CommandText := 'SELECT * FROM dbo.Class';
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;
//
// bdpUpdateCommand1
//
Self.bdpUpdateCommand1.CommandOptions := nil;
Self.bdpUpdateCommand1.CommandText := 'UPDATE dbo.Class SET ID = ?, DepID = ?, Subject = ? WHERE ID = ? AND DepID = ? '+
'AND Subject = ?';
Self.bdpUpdateCommand1.CommandType := System.Data.CommandType.Text;
Self.bdpUpdateCommand1.Connection := Self.BdpConnection1;
Self.bdpUpdateCommand1.ParameterCount := (SmallInt(6));
Self.bdpUpdateCommand1.Parameters.Add(Borland.Data.Common.BdpParameter.Create('ID',
Borland.Data.Common.BdpType.&String, Borland.Data.Common.BdpType.stFixed,
6, System.Data.ParameterDirection.Input, False,
(Byte(0)), (Byte(0)), 0, 'ID', System.Data.DataRowVersion.Current,
nil));
Self.bdpUpdateCommand1.Parameters.Add(Borland.Data.Common.BdpParameter.Create('DepID',
Borland.Data.Common.BdpType.&String, Borland.Data.Common.BdpType.stFixed,
2, System.Data.ParameterDirection.Input, False,
(Byte(0)), (Byte(0)), 0, 'DepID', System.Data.DataRowVersion.Current,
nil));
Self.bdpUpdateCommand1.Parameters.Add(Borland.Data.Common.BdpParameter.Create('Subject',
Borland.Data.Common.BdpType.&String, Borland.Data.Common.BdpType.stFixed,
20, System.Data.ParameterDirection.Input, False,
(Byte(0)), (Byte(0)), 0, 'Subject', System.Data.DataRowVersion.Current,
nil));
Self.bdpUpdateCommand1.Parameters.Add(Borland.Data.Common.BdpParameter.Create('IDOriginal',
Borland.Data.Common.BdpType.&String, Borland.Data.Common.BdpType.stFixed,
6, System.Data.ParameterDirection.Input, False,
(Byte(0)), (Byte(0)), 0, 'ID', System.Data.DataRowVersion.Original,
nil));
Self.bdpUpdateCommand1.Parameters.Add(Borland.Data.Common.BdpParameter.Create('DepIDOriginal',
Borland.Data.Common.BdpType.&String, Borland.Data.Common.BdpType.stFixed,
2, System.Data.ParameterDirection.Input, False,
(Byte(0)), (Byte(0)), 0, 'DepID', System.Data.DataRowVersion.Original,
nil));
Self.bdpUpdateCommand1.Parameters.Add(Borland.Data.Common.BdpParameter.Create('SubjectOriginal',
Borland.Data.Common.BdpType.&String, Borland.Data.Common.BdpType.stFixed,
20, System.Data.ParameterDirection.Input, False,
(Byte(0)), (Byte(0)), 0, 'Subject', System.Data.DataRowVersion.Original,
nil));
Self.bdpUpdateCommand1.SchemaName := nil;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -