1
13606189222
Unregistered / Unconfirmed
GUEST, unregistred user!
我有段VB.NET的程序,数据库老连不上,各位大虾帮忙:
Public Sub ConnectionSysDB(ByVal DBName As String, ByVal PW As String, ByVal OpenClose As Boolean)
Dim ConnectSuperPay As New ADODB.Connection()
Dim StrConnectString As String
Dim DbPathAndName As String
DbPathAndName = SuperPayPath + "/database/" + DBName '确定数据库的路径和文件名
StrConnectString = "Data Source=" + DbPathAndName + ";""Jet OLEDBatabase Password=" + PW + ""
StrConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;" &
_
"Data Source=" + DbPathAndName + ";""Jet OLEDBatabase Password=" + DatabasePassWord + ";"
' MsgBox(StrConnectString)
If OpenClose = True then
With ConnectSuperPay
.CursorLocation = adUseClient
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open(StrConnectString)
End With
else
ConnectSuperPay.Close()
End If
End Sub
Public Sub ConnectionSysDB(ByVal DBName As String, ByVal PW As String, ByVal OpenClose As Boolean)
Dim ConnectSuperPay As New ADODB.Connection()
Dim StrConnectString As String
Dim DbPathAndName As String
DbPathAndName = SuperPayPath + "/database/" + DBName '确定数据库的路径和文件名
StrConnectString = "Data Source=" + DbPathAndName + ";""Jet OLEDBatabase Password=" + PW + ""
StrConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;" &
_
"Data Source=" + DbPathAndName + ";""Jet OLEDBatabase Password=" + DatabasePassWord + ";"
' MsgBox(StrConnectString)
If OpenClose = True then
With ConnectSuperPay
.CursorLocation = adUseClient
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open(StrConnectString)
End With
else
ConnectSuperPay.Close()
End If
End Sub