?? winform.pas.~6~
字號:
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;
CatagoryDataAdapter: Borland.Data.Provider.BdpDataAdapter;
ProductDataAdapter: Borland.Data.Provider.BdpDataAdapter;
dataSet1: System.Data.DataSet;
/// <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;
begin
Self.DataGrid1 := System.Windows.Forms.DataGrid.Create;
Self.DataGrid2 := System.Windows.Forms.DataGrid.Create;
Self.BdpConnection1 := Borland.Data.Provider.BdpConnection.Create;
Self.CatagoryDataAdapter := Borland.Data.Provider.BdpDataAdapter.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.ProductDataAdapter := Borland.Data.Provider.BdpDataAdapter.Create;
Self.bdpSelectCommand2 := Borland.Data.Provider.BdpCommand.Create;
Self.bdpInsertCommand2 := Borland.Data.Provider.BdpCommand.Create;
Self.bdpUpdateCommand2 := Borland.Data.Provider.BdpCommand.Create;
Self.bdpDeleteCommand2 := Borland.Data.Provider.BdpCommand.Create;
Self.dataSet1 := System.Data.DataSet.Create;
(System.ComponentModel.ISupportInitialize(Self.DataGrid1)).BeginInit;
(System.ComponentModel.ISupportInitialize(Self.DataGrid2)).BeginInit;
(System.ComponentModel.ISupportInitialize(Self.CatagoryDataAdapter)).BeginInit;
(System.ComponentModel.ISupportInitialize(Self.ProductDataAdapter)).BeginInit;
(System.ComponentModel.ISupportInitialize(Self.dataSet1)).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';
//
// CatagoryDataAdapter
//
Self.CatagoryDataAdapter.Active := False;
Self.CatagoryDataAdapter.DataSet := Self.dataSet1;
Self.CatagoryDataAdapter.DataTable := nil;
Self.CatagoryDataAdapter.DeleteCommand := Self.bdpDeleteCommand1;
Self.CatagoryDataAdapter.InsertCommand := Self.bdpInsertCommand1;
Self.CatagoryDataAdapter.SelectCommand := Self.bdpSelectCommand1;
Self.CatagoryDataAdapter.StartRecord := 0;
Self.CatagoryDataAdapter.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.CatagoryDataAdapter.UpdateCommand := Self.bdpUpdateCommand1;
//
// bdpSelectCommand1
//
Self.bdpSelectCommand1.CommandOptions := nil;
Self.bdpSelectCommand1.CommandText := 'SELECT * FROM dbo.Categories';
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 dbo.Categories (Categor' +
'yID, CategoryName, Description, Picture ) VALUES ( ?, ?, ?, ?)';
Self.bdpInsertCommand1.CommandType := System.Data.CommandType.Text;
Self.bdpInsertCommand1.Connection := Self.BdpConnection1;
Self.bdpInsertCommand1.ParameterCount := (SmallInt(4));
Self.bdpInsertCommand1.Parameters.Add(Borland.Data.Common.BdpParameter.Create('C' +
'ategoryID', Borland.Data.Common.BdpType.Int32, Borland.Data.Common.BdpType.Unknown,
4, System.Data.ParameterDirection.Input, False, (Byte(0)), (Byte(0)),
0, 'CategoryID', System.Data.DataRowVersion.Current, nil));
Self.bdpInsertCommand1.Parameters.Add(Borland.Data.Common.BdpParameter.Create('C' +
'ategoryName', Borland.Data.Common.BdpType.&String, Borland.Data.Common.BdpType.Unknown,
15, System.Data.ParameterDirection.Input, False, (Byte(15)), (Byte(0)),
15, 'CategoryName', System.Data.DataRowVersion.Current, nil));
Self.bdpInsertCommand1.Parameters.Add(Borland.Data.Common.BdpParameter.Create('D' +
'escription', Borland.Data.Common.BdpType.Blob, Borland.Data.Common.BdpType.stMemo,
-1, System.Data.ParameterDirection.Input, False, (Byte(0)), (Byte(0)),
0, 'Description', System.Data.DataRowVersion.Current, nil));
Self.bdpInsertCommand1.Parameters.Add(Borland.Data.Common.BdpParameter.Create('P' +
'icture', Borland.Data.Common.BdpType.Blob, Borland.Data.Common.BdpType.stBinary,
-1, System.Data.ParameterDirection.Input, False, (Byte(0)), (Byte(0)),
0, 'Picture', System.Data.DataRowVersion.Current, nil));
Self.bdpInsertCommand1.SchemaName := nil;
Self.bdpInsertCommand1.Transaction := nil;
Self.bdpInsertCommand1.UpdatedRowSource := System.Data.UpdateRowSource.None;
//
// bdpUpdateCommand1
//
Self.bdpUpdateCommand1.CommandOptions := nil;
Self.bdpUpdateCommand1.CommandText := 'UPDATE dbo.Categories SET CategoryI' +
'D = ?, CategoryName = ?, Description = ?, Picture = ? WHERE CategoryID = ' +
'? AND CategoryName = ?';
Self.bdpUpdateCommand1.CommandType := System.Data.CommandType.Text;
Self.bdpUpdateCommand1.Connection := Self.BdpConnection1;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -