展开全部
Dim strAppPath As String
strAppPath = App.Path
If Right(strAppPath, 1) <> "\" Then
strAppPath = strAppPath & "\"
End If
strAppPath = strAppPath & "BigText.mdb"
ConnectString = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & strAppPath & ""
Set cnn = New ADODB.Connection
cnn.Open ConnectString
'-----------------sqlDim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim str As Stringcnn.CursorLocation = adUseClient
str = "Provider=SQLOLEDB.1;Persist Security Info =False;" _
& "User ID=sa;" _ '数据库的登录名
& "Pwd=123456;" _ '数据库的密码
& "Initial Catalog=db1;" _
& "Data Source=whx" '连接数据库的名字cnn.Open str
是否可以解决您的问题?
strAppPath = App.Path
If Right(strAppPath, 1) <> "\" Then
strAppPath = strAppPath & "\"
End If
strAppPath = strAppPath & "BigText.mdb"
ConnectString = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & strAppPath & ""
Set cnn = New ADODB.Connection
cnn.Open ConnectString
'-----------------sqlDim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim str As Stringcnn.CursorLocation = adUseClient
str = "Provider=SQLOLEDB.1;Persist Security Info =False;" _
& "User ID=sa;" _ '数据库的登录名
& "Pwd=123456;" _ '数据库的密码
& "Initial Catalog=db1;" _
& "Data Source=whx" '连接数据库的名字cnn.Open str
是否可以解决您的问题?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询