📄 datasets.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace DataSets
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class frmDataSets : System.Windows.Forms.Form
{
private System.Data.DataSet dsEmployees;
private System.Windows.Forms.Label lblEmployees;
private System.Windows.Forms.Label lblClients;
private System.Windows.Forms.Label lblOrders;
private System.Windows.Forms.ListBox lbEmployees;
private System.Windows.Forms.ListBox lbClients;
private System.Windows.Forms.DataGrid dgOrders;
private System.Windows.Forms.Button btnTable;
private System.Windows.Forms.Button btnRelation;
private System.Windows.Forms.Button btnClone;
private System.Windows.Forms.Button btnCopy;
private System.Data.SqlClient.SqlConnection cnNorthwind;
private System.Data.SqlClient.SqlCommand cmdSelectCustomers;
private System.Data.SqlClient.SqlDataAdapter daCustomers;
private System.Data.SqlClient.SqlCommand cmdSelectOrders;
private System.Data.SqlClient.SqlDataAdapter daOrders;
private System.Data.SqlClient.SqlCommand cmdSelectEmployees;
private System.Data.SqlClient.SqlDataAdapter daEmployees;
private DataSets.dsMaster dsMaster1;
private System.Data.DataSet dsUntyped;
private System.Data.DataTable dtMaster;
private System.Data.DataColumn MasterID;
private System.Data.DataColumn MasterValue;
private System.Data.DataTable dtChild;
private System.Data.DataColumn ChildID;
private System.Data.DataColumn MasterLink;
private System.Data.DataColumn ChildValue;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public frmDataSets()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
dsEmployees = new System.Data.DataSet("dsEmployees");
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#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>
private void InitializeComponent()
{
this.lblEmployees = new System.Windows.Forms.Label();
this.lblClients = new System.Windows.Forms.Label();
this.lblOrders = new System.Windows.Forms.Label();
this.lbEmployees = new System.Windows.Forms.ListBox();
this.lbClients = new System.Windows.Forms.ListBox();
this.dgOrders = new System.Windows.Forms.DataGrid();
this.btnTable = new System.Windows.Forms.Button();
this.btnRelation = new System.Windows.Forms.Button();
this.btnClone = new System.Windows.Forms.Button();
this.btnCopy = new System.Windows.Forms.Button();
this.cnNorthwind = new System.Data.SqlClient.SqlConnection();
this.cmdSelectCustomers = new System.Data.SqlClient.SqlCommand();
this.daCustomers = new System.Data.SqlClient.SqlDataAdapter();
this.cmdSelectOrders = new System.Data.SqlClient.SqlCommand();
this.daOrders = new System.Data.SqlClient.SqlDataAdapter();
this.cmdSelectEmployees = new System.Data.SqlClient.SqlCommand();
this.daEmployees = new System.Data.SqlClient.SqlDataAdapter();
this.dsMaster1 = new DataSets.dsMaster();
this.dsUntyped = new System.Data.DataSet();
this.dtMaster = new System.Data.DataTable();
this.MasterID = new System.Data.DataColumn();
this.MasterValue = new System.Data.DataColumn();
this.dtChild = new System.Data.DataTable();
this.ChildID = new System.Data.DataColumn();
this.MasterLink = new System.Data.DataColumn();
this.ChildValue = new System.Data.DataColumn();
((System.ComponentModel.ISupportInitialize)(this.dgOrders)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dsMaster1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dsUntyped)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dtMaster)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dtChild)).BeginInit();
this.SuspendLayout();
//
// lblEmployees
//
this.lblEmployees.AutoSize = true;
this.lblEmployees.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblEmployees.Location = new System.Drawing.Point(8, 8);
this.lblEmployees.Name = "lblEmployees";
this.lblEmployees.Size = new System.Drawing.Size(66, 13);
this.lblEmployees.TabIndex = 0;
this.lblEmployees.Text = "Employees:";
//
// lblClients
//
this.lblClients.AutoSize = true;
this.lblClients.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblClients.Location = new System.Drawing.Point(200, 8);
this.lblClients.Name = "lblClients";
this.lblClients.Size = new System.Drawing.Size(44, 13);
this.lblClients.TabIndex = 1;
this.lblClients.Text = "Clients:";
//
// lblOrders
//
this.lblOrders.AutoSize = true;
this.lblOrders.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblOrders.Location = new System.Drawing.Point(8, 136);
this.lblOrders.Name = "lblOrders";
this.lblOrders.Size = new System.Drawing.Size(43, 13);
this.lblOrders.TabIndex = 2;
this.lblOrders.Text = "Orders:";
//
// lbEmployees
//
this.lbEmployees.Location = new System.Drawing.Point(8, 24);
this.lbEmployees.Name = "lbEmployees";
this.lbEmployees.Size = new System.Drawing.Size(184, 95);
this.lbEmployees.TabIndex = 1;
//
// lbClients
//
this.lbClients.Location = new System.Drawing.Point(200, 24);
this.lbClients.Name = "lbClients";
this.lbClients.Size = new System.Drawing.Size(200, 95);
this.lbClients.TabIndex = 2;
//
// dgOrders
//
this.dgOrders.DataMember = "";
this.dgOrders.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dgOrders.Location = new System.Drawing.Point(8, 152);
this.dgOrders.Name = "dgOrders";
this.dgOrders.Size = new System.Drawing.Size(392, 208);
this.dgOrders.TabIndex = 3;
//
// btnTable
//
this.btnTable.Location = new System.Drawing.Point(416, 32);
this.btnTable.Name = "btnTable";
this.btnTable.Size = new System.Drawing.Size(96, 23);
this.btnTable.TabIndex = 4;
this.btnTable.Text = "Create Table";
this.btnTable.Click += new System.EventHandler(this.btnTable_Click);
//
// btnRelation
//
this.btnRelation.Location = new System.Drawing.Point(416, 64);
this.btnRelation.Name = "btnRelation";
this.btnRelation.Size = new System.Drawing.Size(96, 23);
this.btnRelation.TabIndex = 5;
this.btnRelation.Text = "Create Relation";
this.btnRelation.Click += new System.EventHandler(this.btnRelation_Click);
//
// btnClone
//
this.btnClone.Location = new System.Drawing.Point(416, 96);
this.btnClone.Name = "btnClone";
this.btnClone.Size = new System.Drawing.Size(96, 23);
this.btnClone.TabIndex = 6;
this.btnClone.Text = "Clone DataSet";
this.btnClone.Click += new System.EventHandler(this.btnClone_Click);
//
// btnCopy
//
this.btnCopy.Location = new System.Drawing.Point(416, 128);
this.btnCopy.Name = "btnCopy";
this.btnCopy.Size = new System.Drawing.Size(96, 23);
this.btnCopy.TabIndex = 7;
this.btnCopy.Text = "Copy DataSet";
this.btnCopy.Click += new System.EventHandler(this.btnCopy_Click);
//
// cnNorthwind
//
this.cnNorthwind.ConnectionString = "data source=localhost;initial catalog=nwind;integrated security=SSPI;persist " +
"security info=False;packet size=4096";
//
// cmdSelectCustomers
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -