公共模組
阿新 • • 發佈:2018-12-04
Imports System.Data
Imports System.Data.OleDb
Module 公共模組
Public bo As String '模組級別的變數記錄使用者名稱
Public adocmd As OleDbDataAdapter
Public ds As DataSet
Public mytable As Data.DataTable
Public com_fdir As New System.IO.DirectoryInfo(Application.StartupPath)
Public com_fdist As String = com_fdir.Parent.Parent.Parent.Parent.Parent.FullName.ToString
'自定義函式過程,用於查詢資料
Public Function executesql(ByVal sql As String, ByVal table As String)
'Console.WriteLine("com_fdir = " & com_fdir.ToString)
'Console.WriteLine("com_fdist = " & com_fdist)
Dim database_dir As String = com_fdist & "\bookmanage\bookmanage1.mdb "
adocmd = New OleDbDataAdapter(sql, "provider = microsoft.jet.oledb.4.0;data source = " & database_dir & ";Jet OLEDB:DataBase password = Dhb321;")
ds = New DataSet
adocmd.Fill(ds, table)
mytable = ds.Tables.Item(0)
End Function
'自定義函式過程,用於查詢資料,異常丟擲
Public Function executesql(ByVal sql As String, ByVal table As String, ByRef x_p As String)
Dim database_dir As String = com_fdist & "\bookmanage\bookmanage1.mdb "
adocmd = New OleDbDataAdapter(sql, "provider = microsoft.jet.oledb.4.0;data source =" & database_dir & ";Jet OLEDB:DataBase password = Dhb321;")
ds = New DataSet
adocmd.Fill(ds, table)
mytable = ds.Tables.Item(0)
Console.WriteLine("executesql = " + mytable.Rows(0)(0))
'Dim newrow As DataRow
'newrow = mytable.NewRow
'MsgBox(mytable.Rows.Item(1).Item(0))
'Console.WriteLine(newrow.Item(0))
'MsgBox(newrow.Item(0))
'MsgBox(x_p)
'If newrow.Item(0) <> x_p Then
'End If
End Function
End Module
Imports System.Data.OleDb
Module 公共模組
Public bo As String '模組級別的變數記錄使用者名稱
Public adocmd As OleDbDataAdapter
Public ds As DataSet
Public mytable As Data.DataTable
Public com_fdir As New System.IO.DirectoryInfo(Application.StartupPath)
Public com_fdist As String = com_fdir.Parent.Parent.Parent.Parent.Parent.FullName.ToString
'自定義函式過程,用於查詢資料
Public Function executesql(ByVal sql As String, ByVal table As String)
'Console.WriteLine("com_fdir = " & com_fdir.ToString)
'Console.WriteLine("com_fdist = " & com_fdist)
Dim database_dir As String = com_fdist & "\bookmanage\bookmanage1.mdb "
adocmd = New OleDbDataAdapter(sql, "provider = microsoft.jet.oledb.4.0;data source = " & database_dir & ";Jet OLEDB:DataBase password = Dhb321;")
ds = New DataSet
adocmd.Fill(ds, table)
mytable = ds.Tables.Item(0)
End Function
'自定義函式過程,用於查詢資料,異常丟擲
Public Function executesql(ByVal sql As String, ByVal table As String, ByRef x_p As String)
Dim database_dir As String = com_fdist & "\bookmanage\bookmanage1.mdb "
adocmd = New OleDbDataAdapter(sql, "provider = microsoft.jet.oledb.4.0;data source =" & database_dir & ";Jet OLEDB:DataBase password = Dhb321;")
ds = New DataSet
adocmd.Fill(ds, table)
mytable = ds.Tables.Item(0)
Console.WriteLine("executesql = " + mytable.Rows(0)(0))
'Dim newrow As DataRow
'newrow = mytable.NewRow
'MsgBox(mytable.Rows.Item(1).Item(0))
'Console.WriteLine(newrow.Item(0))
'MsgBox(newrow.Item(0))
'MsgBox(x_p)
'If newrow.Item(0) <> x_p Then
'End If
End Function
End Module