📄 datasets.vb
字号:
Public Class frmDataSets
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
Friend WithEvents cnNorthwind As System.Data.SqlClient.SqlConnection
Friend WithEvents cmdSelectCustomers As System.Data.SqlClient.SqlCommand
Friend WithEvents daCustomers As System.Data.SqlClient.SqlDataAdapter
Friend WithEvents cmdSelectOrders As System.Data.SqlClient.SqlCommand
Friend WithEvents cmdSelectEmployees As System.Data.SqlClient.SqlCommand
Friend WithEvents daEmployees As System.Data.SqlClient.SqlDataAdapter
Friend WithEvents lblEmployees As System.Windows.Forms.Label
Friend WithEvents lblClients As System.Windows.Forms.Label
Friend WithEvents lblOrders As System.Windows.Forms.Label
Friend WithEvents dgOrders As System.Windows.Forms.DataGrid
Friend WithEvents lbEmployees As System.Windows.Forms.ListBox
Friend WithEvents lbClients As System.Windows.Forms.ListBox
Friend WithEvents daOrders As System.Data.SqlClient.SqlDataAdapter
Friend WithEvents btnTable As System.Windows.Forms.Button
Friend WithEvents btnRelation As System.Windows.Forms.Button
Friend WithEvents btnClone As System.Windows.Forms.Button
Friend WithEvents btnCopy As System.Windows.Forms.Button
'Required by the Windows Form Designer
Private components As System.ComponentModel.Container
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.lblClients = New System.Windows.Forms.Label()
Me.dgOrders = New System.Windows.Forms.DataGrid()
Me.lblEmployees = New System.Windows.Forms.Label()
Me.daOrders = New System.Data.SqlClient.SqlDataAdapter()
Me.cmdSelectOrders = New System.Data.SqlClient.SqlCommand()
Me.cnNorthwind = New System.Data.SqlClient.SqlConnection()
Me.cmdSelectEmployees = New System.Data.SqlClient.SqlCommand()
Me.daEmployees = New System.Data.SqlClient.SqlDataAdapter()
Me.lblOrders = New System.Windows.Forms.Label()
Me.lbClients = New System.Windows.Forms.ListBox()
Me.lbEmployees = New System.Windows.Forms.ListBox()
Me.cmdSelectCustomers = New System.Data.SqlClient.SqlCommand()
Me.daCustomers = New System.Data.SqlClient.SqlDataAdapter()
Me.btnTable = New System.Windows.Forms.Button()
Me.btnRelation = New System.Windows.Forms.Button()
Me.btnClone = New System.Windows.Forms.Button()
Me.btnCopy = New System.Windows.Forms.Button()
CType(Me.dgOrders, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'lblClients
'
Me.lblClients.AutoSize = True
Me.lblClients.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblClients.Location = New System.Drawing.Point(200, 8)
Me.lblClients.Name = "lblClients"
Me.lblClients.Size = New System.Drawing.Size(44, 13)
Me.lblClients.TabIndex = 0
Me.lblClients.Text = "Clients:"
'
'dgOrders
'
Me.dgOrders.DataMember = ""
Me.dgOrders.Location = New System.Drawing.Point(8, 152)
Me.dgOrders.Name = "dgOrders"
Me.dgOrders.Size = New System.Drawing.Size(392, 208)
Me.dgOrders.TabIndex = 3
'
'lblEmployees
'
Me.lblEmployees.AutoSize = True
Me.lblEmployees.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblEmployees.Location = New System.Drawing.Point(8, 8)
Me.lblEmployees.Name = "lblEmployees"
Me.lblEmployees.Size = New System.Drawing.Size(66, 13)
Me.lblEmployees.TabIndex = 0
Me.lblEmployees.Text = "Employees:"
'
'daOrders
'
Me.daOrders.SelectCommand = Me.cmdSelectOrders
Me.daOrders.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "OrderTotals", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("CustomerID", "CustomerID"), New System.Data.Common.DataColumnMapping("OrderID", "OrderID"), New System.Data.Common.DataColumnMapping("OrderDate", "OrderDate"), New System.Data.Common.DataColumnMapping("Subtotal", "Subtotal")})})
'
'cmdSelectOrders
'
Me.cmdSelectOrders.CommandText = "SELECT EmployeeID, CustomerID, OrderID, OrderDate, Subtotal FROM OrderTotals"
Me.cmdSelectOrders.Connection = Me.cnNorthwind
'
'cnNorthwind
'
Me.cnNorthwind.ConnectionString = "data source=localhost;initial catalog=nwind;integrated security=SSPI;persist " & _
"security info=False;packet size=4096"
'
'cmdSelectEmployees
'
Me.cmdSelectEmployees.CommandText = "SELECT EmployeeID, FirstName, LastName FROM EmployeeList"
Me.cmdSelectEmployees.Connection = Me.cnNorthwind
'
'daEmployees
'
Me.daEmployees.SelectCommand = Me.cmdSelectEmployees
Me.daEmployees.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "EmployeeList", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("EmployeeID", "EmployeeID"), New System.Data.Common.DataColumnMapping("FirstName", "FirstName"), New System.Data.Common.DataColumnMapping("LastName", "LastName")})})
'
'lblOrders
'
Me.lblOrders.AutoSize = True
Me.lblOrders.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblOrders.Location = New System.Drawing.Point(8, 136)
Me.lblOrders.Name = "lblOrders"
Me.lblOrders.Size = New System.Drawing.Size(43, 13)
Me.lblOrders.TabIndex = 0
Me.lblOrders.Text = "Orders:"
'
'lbClients
'
Me.lbClients.Location = New System.Drawing.Point(200, 24)
Me.lbClients.Name = "lbClients"
Me.lbClients.Size = New System.Drawing.Size(200, 95)
Me.lbClients.TabIndex = 2
'
'lbEmployees
'
Me.lbEmployees.Location = New System.Drawing.Point(8, 24)
Me.lbEmployees.Name = "lbEmployees"
Me.lbEmployees.Size = New System.Drawing.Size(184, 95)
Me.lbEmployees.TabIndex = 1
'
'cmdSelectCustomers
'
Me.cmdSelectCustomers.CommandText = "SELECT CustomerID, CompanyName, City, Country, PostalCode, Region FROM CustomerLi" & _
"st"
Me.cmdSelectCustomers.Connection = Me.cnNorthwind
'
'daCustomers
'
Me.daCustomers.SelectCommand = Me.cmdSelectCustomers
Me.daCustomers.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "CustomerList", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("CustomerID", "CustomerID"), New System.Data.Common.DataColumnMapping("CompanyName", "CompanyName"), New System.Data.Common.DataColumnMapping("City", "City"), New System.Data.Common.DataColumnMapping("Country", "Country"), New System.Data.Common.DataColumnMapping("PostalCode", "PostalCode"), New System.Data.Common.DataColumnMapping("Region", "Region")})})
'
'btnTable
'
Me.btnTable.Location = New System.Drawing.Point(416, 32)
Me.btnTable.Name = "btnTable"
Me.btnTable.Size = New System.Drawing.Size(96, 23)
Me.btnTable.TabIndex = 4
Me.btnTable.Text = "CreateTable"
'
'btnRelation
'
Me.btnRelation.Location = New System.Drawing.Point(416, 64)
Me.btnRelation.Name = "btnRelation"
Me.btnRelation.Size = New System.Drawing.Size(96, 23)
Me.btnRelation.TabIndex = 4
Me.btnRelation.Text = "Create Relation"
'
'btnClone
'
Me.btnClone.Location = New System.Drawing.Point(416, 96)
Me.btnClone.Name = "btnClone"
Me.btnClone.Size = New System.Drawing.Size(96, 23)
Me.btnClone.TabIndex = 4
Me.btnClone.Text = "Clone DataSet"
'
'btnCopy
'
Me.btnCopy.Location = New System.Drawing.Point(416, 128)
Me.btnCopy.Name = "btnCopy"
Me.btnCopy.Size = New System.Drawing.Size(96, 23)
Me.btnCopy.TabIndex = 4
Me.btnCopy.Text = "Copy DataSet"
'
'frmDataSets
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(520, 373)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnCopy, Me.btnClone, Me.btnRelation, Me.btnTable, Me.dgOrders, Me.lbClients, Me.lbEmployees, Me.lblOrders, Me.lblClients, Me.lblEmployees})
Me.Name = "frmDataSets"
Me.Text = "DataSets"
CType(Me.dgOrders, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -