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