📄 winform.pas.~7~
字号:
unit WinForm;
interface
uses
System.Drawing, System.Collections, System.ComponentModel,
System.Windows.Forms, System.Data, Borland.Data.Provider, Borland.Data.Common,
DataSet1Unit, System.Globalization, System.Data.Common;
type
TWinForm = class(System.Windows.Forms.Form)
{$REGION 'Designer Managed Code'}
strict private
/// <summary>
/// Required designer variable.
/// </summary>
Components: System.ComponentModel.Container;
BdpConnection1: Borland.Data.Provider.BdpConnection;
bdpSelectCommand1: Borland.Data.Provider.BdpCommand;
bdpInsertCommand1: Borland.Data.Provider.BdpCommand;
bdpUpdateCommand1: Borland.Data.Provider.BdpCommand;
bdpDeleteCommand1: Borland.Data.Provider.BdpCommand;
bdpSelectCommand2: Borland.Data.Provider.BdpCommand;
bdpInsertCommand2: Borland.Data.Provider.BdpCommand;
bdpUpdateCommand2: Borland.Data.Provider.BdpCommand;
bdpDeleteCommand2: Borland.Data.Provider.BdpCommand;
DataGrid1: System.Windows.Forms.DataGrid;
DataGrid2: System.Windows.Forms.DataGrid;
CategoryAdapter: Borland.Data.Provider.BdpDataAdapter;
ProductAdapter: Borland.Data.Provider.BdpDataAdapter;
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;
DataColumn9: System.Data.DataColumn;
DataColumn10: System.Data.DataColumn;
DataTable2: System.Data.DataTable;
DataColumn11: System.Data.DataColumn;
DataColumn12: System.Data.DataColumn;
DataColumn13: System.Data.DataColumn;
DataColumn14: 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 TWinForm_Load(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 }
public
constructor Create;
end;
[assembly: RuntimeRequiredAttribute(TypeOf(TWinForm))]
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 TWinForm.InitializeComponent;
type
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;
TArrayOfWideChar = array of WideChar;
TArrayOfByte = array of Byte;
begin
Self.DataGrid1 := System.Windows.Forms.DataGrid.Create;
Self.DataGrid2 := System.Windows.Forms.DataGrid.Create;
Self.BdpConnection1 := Borland.Data.Provider.BdpConnection.Create;
Self.CategoryAdapter := 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;
Self.DataColumn9 := System.Data.DataColumn.Create;
Self.DataColumn10 := System.Data.DataColumn.Create;
Self.DataTable2 := System.Data.DataTable.Create;
Self.DataColumn11 := System.Data.DataColumn.Create;
Self.DataColumn12 := System.Data.DataColumn.Create;
Self.DataColumn13 := System.Data.DataColumn.Create;
Self.DataColumn14 := System.Data.DataColumn.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.ProductAdapter := 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;
(System.ComponentModel.ISupportInitialize(Self.DataGrid1)).BeginInit;
(System.ComponentModel.ISupportInitialize(Self.DataGrid2)).BeginInit;
(System.ComponentModel.ISupportInitialize(Self.CategoryAdapter)).BeginInit;
(System.ComponentModel.ISupportInitialize(Self.dataSet1)).BeginInit;
(System.ComponentModel.ISupportInitialize(Self.DataTable1)).BeginInit;
(System.ComponentModel.ISupportInitialize(Self.DataTable2)).BeginInit;
(System.ComponentModel.ISupportInitialize(Self.ProductAdapter)).BeginInit;
Self.SuspendLayout;
//
// DataGrid1
//
Self.DataGrid1.CaptionText := 'Customers';
Self.DataGrid1.DataMember := '';
Self.DataGrid1.HeaderForeColor := System.Drawing.SystemColors.ControlText;
Self.DataGrid1.Location := System.Drawing.Point.Create(8, 0);
Self.DataGrid1.Name := 'DataGrid1';
Self.DataGrid1.Size := System.Drawing.Size.Create(373, 171);
Self.DataGrid1.TabIndex := 0;
//
// DataGrid2
//
Self.DataGrid2.CaptionText := 'Ouders';
Self.DataGrid2.DataMember := '';
Self.DataGrid2.HeaderForeColor := System.Drawing.SystemColors.ControlText;
Self.DataGrid2.Location := System.Drawing.Point.Create(7, 186);
Self.DataGrid2.Name := 'DataGrid2';
Self.DataGrid2.Size := System.Drawing.Size.Create(373, 156);
Self.DataGrid2.TabIndex := 1;
//
// BdpConnection1
//
Self.BdpConnection1.ConnectionOptions := 'transaction isolation=ReadCommit' +
'ted;blobsize=1024';
Self.BdpConnection1.ConnectionString := 'assembly=Borland.Data.Mssql,Versi' +
'on=2.0.0.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b;vendorclient=s' +
'qloledb.dll;osauthentication=True;database=Northwind;username=;hostname=E' +
'CON-IBM-T40-G7;password=;provider=MSSQL';
//
// CategoryAdapter
//
Self.CategoryAdapter.Active := True;
Self.CategoryAdapter.DataSet := Self.dataSet1;
Self.CategoryAdapter.DataTable := Self.DataTable2;
Self.CategoryAdapter.DeleteCommand := Self.bdpDeleteCommand1;
Self.CategoryAdapter.InsertCommand := Self.bdpInsertCommand1;
Self.CategoryAdapter.SelectCommand := Self.bdpSelectCommand1;
Self.CategoryAdapter.StartRecord := 0;
Self.CategoryAdapter.TableMappings.AddRange(TArrayOfSystem_Data_Common_DataTableMapping.Create(System.Data.Common.DataTableMapping.Create('T' +
'able', 'Categories', TArrayOfSystem_Data_Common_DataColumnMapping.Create(System.Data.Common.DataColumnMapping.Create('C' +
'ategoryID', 'CategoryID'), System.Data.Common.DataColumnMapping.Create('C' +
'ategoryName', 'CategoryName'), System.Data.Common.DataColumnMapping.Create('D' +
'escription', 'Description'), System.Data.Common.DataColumnMapping.Create('P' +
'icture', 'Picture')))));
Self.CategoryAdapter.UpdateCommand := Self.bdpUpdateCommand1;
//
// dataSet1
//
Self.dataSet1.DataSetName := 'NewDataSet';
Self.dataSet1.Locale := System.Globalization.CultureInfo.Create('zh-CN');
Self.dataSet1.Tables.AddRange(TArrayOfSystem_Data_DataTable.Create(Self.DataTable1,
Self.DataTable2));
//
// DataTable1
//
Self.DataTable1.Columns.AddRange(TArrayOfSystem_Data_DataColumn.Create(Self.DataColumn1,
Self.DataColumn2, Self.DataColumn3, Self.DataColumn4, Self.DataColumn5,
Self.DataColumn6, Self.DataColumn7, Self.DataColumn8, Self.DataColumn9,
Self.DataColumn10));
Self.DataTable1.Constraints.AddRange(TArrayOfSystem_Data_Constraint.Create(System.Data.UniqueConstraint.Create('C' +
'onstraint1', TArrayOfString.Create('ProductID'), True)));
Self.DataTable1.PrimaryKey := TArrayOfSystem_Data_DataColumn.Create(Self.DataColumn1);
Self.DataTable1.TableName := 'Products';
//
// DataColumn1
//
Self.DataColumn1.AllowDBNull := False;
Self.DataColumn1.ColumnName := 'ProductID';
Self.DataColumn1.DataType := TypeOf(Integer);
//
// DataColumn2
//
Self.DataColumn2.AllowDBNull := False;
Self.DataColumn2.ColumnName := 'ProductName';
Self.DataColumn2.MaxLength := 40;
//
// DataColumn3
//
Self.DataColumn3.ColumnName := 'SupplierID';
Self.DataColumn3.DataType := TypeOf(Integer);
//
// DataColumn4
//
Self.DataColumn4.ColumnName := 'CategoryID';
Self.DataColumn4.DataType := TypeOf(Integer);
//
// DataColumn5
//
Self.DataColumn5.ColumnName := 'QuantityPerUnit';
Self.DataColumn5.MaxLength := 20;
//
// DataColumn6
//
Self.DataColumn6.ColumnName := 'UnitPrice';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -