moduleassent.vb

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

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

Module ModuleAssent

    Public assentDataSet As DataSet = New DataSet
    Dim CustDataAdapter As New SqlDataAdapter
    Dim conn As New SqlConnection
    'Dim StrData As String
    Public assentTable As DataTable
    Public assentRow As DataRow


    Dim StrSql As String


    Public ObjForm1 As New Form1

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

        conn = New SqlConnection(StrData)

        StrSql = "select * from T_ASSET_MAIN"

        conn.Open()

        Dim myCommand As SqlCommand = New SqlCommand(StrSql, conn)
        CustDataAdapter.SelectCommand = myCommand

        CustDataAdapter.Fill(assentDataSet, "T_ASSET_MAIN")

        For Each assentRow In assentDataSet.Tables("T_ASSET_MAIN").Rows
            'Me.ComboBox2.Items.Add(DepartementRow("TYPE_NAME"))
        Next
        conn.Close()


        assentTable = assentDataSet.Tables("T_ASSET_MAIN")
        assentTable = assentDataSet.Tables(0)

    End Sub

End Module

⌨️ 快捷键说明

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