moduledepartement.vb

来自「固定资产管理信息系统,虽然还有些不足,但基本功能已实现!希望大家多多改进!」· VB 代码 · 共 49 行

VB
49
字号
Imports System.Data
Imports System.Data.sqlClient

Module ModuleDepartement

    Public DepartementDataSet As DataSet = New DataSet
    Dim CustDataAdapter As New SqlDataAdapter
    Dim conn As New SqlConnection
    'Dim StrData As String
    Public DepartementTable As DataTable
    Public DepartementRow As DataRow

    Dim StrSql As String

    Public ObjForm1 As New Form1
    ' Dim ObjResch As New resch


    Public Sub Departement()
        ' StrData = "User ID=sa;Password=;Trusted_Connection=yes;Initial Catalog=assent;data source=localhost"

        conn = New SqlConnection(StrData)

        StrSql = "select * from T_DEPARTMENT"

        Dim myCommand As SqlCommand = New SqlCommand(StrSql, conn)

        conn.Open()

        CustDataAdapter.SelectCommand = myCommand



        CustDataAdapter.Fill(DepartementDataSet, "T_DEPARTMENT")

        For Each DepartementRow In DepartementDataSet.Tables("T_DEPARTMENT").Rows
            'ObjResch.ComboBox1.Items.Add(DepartementRow("DepName"))
        Next


        conn.Close()

        DepartementTable = DepartementDataSet.Tables("T_DEPARTMENT")
        DepartementTable = DepartementDataSet.Tables(0)
     
    End Sub

End Module

⌨️ 快捷键说明

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