我试图运行一种非常基本的代码来使用ADODB以几种3种不同的语言Vbscript,Python和Powershell访问数据库,并且每次收到以下错误消息:
参数类型错误,超出可接受范围或彼此冲突。
这是一个简单的VBScript代码,我从网络上下来然后对其进行了稍微的修改:
Sub Test
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adUseClient = 3
Dim objConnection, objRecordset
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordset = CreateObject("ADODB.Recordset")
objConnection.Open "DSN=My_DSN;"
objRecordset.CursorLocation = adUseClient
objRecordset.Open "SELECT * FROM my_table", objConnection, adOpenStatic, adLockOptimistic
objRecordSet.MoveFirst
Dim x, y, z, recordStr
Do Until objRecordset.EOF
x = objRecordset.Fields.Item(1)
y = objRecordset.Fields.Item(2)
z = objRecordset.Fields.Item(3)
recordStr = CStr(x) + "," + CStr(y) + "," + CStr(z)
WScript.Echo recordStr
objRecordset.MoveNext
Loop
objRecordset.Close
objConnection.Close
End Sub
Call Test
无论我使用哪种语言或不同的代码版本,以上错误都会在我的objRecordset.Open
调用中发生。我过去使用过ADODB,但从未遇到过此问题,那么,这有什么用呢?我的ADODB API是否会以某种方式损坏?