使用的vb6+adodc+access,sql语句查询错误

来源:百度知道 编辑:UC知道 时间:2024/06/07 12:11:28
Dim str As String
Dim path As String
path = App.path
str = path
If Right(str, 1) <> "\" Then
str = str + "\"
Else
str = str
End If
str = "Provider=Microsoft.Jet.OLEDB.4.0;;Persist Security Info=False;Data Source=" & str & "studentsinfo.mdb"

Adodc1.Recordset.Open "select * from information", str, adOpenStatic, adLockOptimistic

使用的vb6+adodc+access。

请问怎么回事啊?
2楼的,谢谢了,我改为了Dim str As String
Dim path As String
path = App.path
str = path
If Right(str, 1) <> "\" Then
str = str + "\"
Else
str = str
End If
str = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & str & "studentsinfo.mdb"
Adodc1.ConnectionString = str
Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = "select * from information"
Ad

你使用ADO控件,就不要使用ADO数据对象,代码修改如下:
Dim str As String
Dim path As String
path = App.path
str = path
If Right(str, 1) <> "\" Then
str = str + "\"
Else
str = str
End If
str = "Provider=Microsoft.Jet.OLEDB.4.0;;Persist Security Info=False;Data Source=" & str & "studentsinfo.mdb"
Adodc1.ConnectionString = str
Adodc1.RecordSource = "select * from information"
Adodc1.Refresh

其它请参阅http://zhidao.baidu.com/question/18200814.html的本人答复.