Public Const Cn_String1 As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
Public Work_cn As New ADODB.Connection
Public Work_rs As New ADODB.Recordset
'连接
Public Function ConnectWorkDataBase(ByVal FileName As String) As Boolean
Try
Work_cn.Open(Cn_String1 & FileName)
Return True
Catch ex As Exception
End Try
Return False
End Function
'查询
Dim Sql As String = "select * from tb1"
Work_rs.Open(Sql, Work_cn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)