主题:请高手帮忙解决ODBC的问题
窗体上的一个按钮,需要打开三个数据库(两个VF的,一个ACCESS的)。代码如下:
Sub cmdOpen_Click()
On Error GoTo ErrHandle
qmingc = Right(txtDB, 11)
jjmingc = Right(Text1, 8)
Dim db_reg As Database
Dim rstt As DAO.Recordset
Set db_reg = OpenDatabase(txtReg, False, False)
Set rstt = db_reg.OpenRecordset("select * from dealers ")
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim cnstr As String
cnstr = "PROVIDER=MSDASQL.1;Persist Security Info=False;Driver={Microsoft Visual FoxPro Driver};" & _
"SourceType=DBF;" & _
"SourceDB=" & txtDB & "\data;" & _
"Exclusive=No"
Set rs = New ADODB.Recordset
cn.Open cnstr
Set rs = New ADODB.Recordset
'rs.CursorLocation = adUseClient
rs.Open "select * from " & qmingc & " where ss>0 and gj=21 order by bh", cn, 1, 4
bianh = rs("bh")
shu = rs.RecordCount
If shu > 0 Then
rs.MoveFirst
End If
Dim cn1 As New ADODB.Connection
Dim rs1 As ADODB.Recordset
Dim cnstr1 As String
cnstr1 = "PROVIDER=MSDASQL.1;Persist Security Info=False;Driver={Microsoft Visual FoxPro Driver};" & _
"SourceType=DBF;" & _
"SourceDB=" & Text1 & "\data;" & _
"Exclusive=No"
cn1.Open cnstr1
Set rs1 = New ADODB.Recordset
'rs1.CursorLocation = adUseClient
rs1.Open "select * from " & jjmingc & "", cn1, 1, 4
MsgBox "Open database successfully!", 48, pTitle
Exit Sub
ErrHandle:
MsgBox "Read of database is error! " & Err.Description, 48, pTitle
End Sub
在好多电脑上运行都没问题,但有的电脑却出现以下错误 :
Read of database is error! Microsoft ODBC Driver Manager driver does not support this function.
请问要怎么解决啊
Sub cmdOpen_Click()
On Error GoTo ErrHandle
qmingc = Right(txtDB, 11)
jjmingc = Right(Text1, 8)
Dim db_reg As Database
Dim rstt As DAO.Recordset
Set db_reg = OpenDatabase(txtReg, False, False)
Set rstt = db_reg.OpenRecordset("select * from dealers ")
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim cnstr As String
cnstr = "PROVIDER=MSDASQL.1;Persist Security Info=False;Driver={Microsoft Visual FoxPro Driver};" & _
"SourceType=DBF;" & _
"SourceDB=" & txtDB & "\data;" & _
"Exclusive=No"
Set rs = New ADODB.Recordset
cn.Open cnstr
Set rs = New ADODB.Recordset
'rs.CursorLocation = adUseClient
rs.Open "select * from " & qmingc & " where ss>0 and gj=21 order by bh", cn, 1, 4
bianh = rs("bh")
shu = rs.RecordCount
If shu > 0 Then
rs.MoveFirst
End If
Dim cn1 As New ADODB.Connection
Dim rs1 As ADODB.Recordset
Dim cnstr1 As String
cnstr1 = "PROVIDER=MSDASQL.1;Persist Security Info=False;Driver={Microsoft Visual FoxPro Driver};" & _
"SourceType=DBF;" & _
"SourceDB=" & Text1 & "\data;" & _
"Exclusive=No"
cn1.Open cnstr1
Set rs1 = New ADODB.Recordset
'rs1.CursorLocation = adUseClient
rs1.Open "select * from " & jjmingc & "", cn1, 1, 4
MsgBox "Open database successfully!", 48, pTitle
Exit Sub
ErrHandle:
MsgBox "Read of database is error! " & Err.Description, 48, pTitle
End Sub
在好多电脑上运行都没问题,但有的电脑却出现以下错误 :
Read of database is error! Microsoft ODBC Driver Manager driver does not support this function.
请问要怎么解决啊