datasets.vb

来自「东软内部材料(六)ado .net相关」· VB 代码 · 共 352 行 · 第 1/2 页

VB
352
字号
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
    Dim dsEmployees As New System.Data.DataSet("dsEmployees")
                            
    '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.
    Friend WithEvents DsMaster1 As DataSets.dsMaster
    Friend WithEvents dsUntyped As System.Data.DataSet
    Friend WithEvents dtMaster As System.Data.DataTable
    Friend WithEvents MasterID As System.Data.DataColumn
    Friend WithEvents MasterValue As System.Data.DataColumn
    Friend WithEvents dtChild As System.Data.DataTable
    Friend WithEvents ChildID As System.Data.DataColumn
    Friend WithEvents MasterLink As System.Data.DataColumn
    Friend WithEvents ChildValue As System.Data.DataColumn
    <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()
        Me.DsMaster1 = New DataSets.dsMaster()
        Me.dsUntyped = New System.Data.DataSet()
        Me.dtMaster = New System.Data.DataTable()
        Me.MasterID = New System.Data.DataColumn()
        Me.MasterValue = New System.Data.DataColumn()
        Me.dtChild = New System.Data.DataTable()
        Me.ChildID = New System.Data.DataColumn()
        Me.MasterLink = New System.Data.DataColumn()
        Me.ChildValue = New System.Data.DataColumn()
        CType(Me.dgOrders, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.DsMaster1, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.dsUntyped, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.dtMaster, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.dtChild, 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.HeaderForeColor = System.Drawing.SystemColors.ControlText
        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
        '

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?