我正在尝试添加参数,但我收到的错误如下:
glCommand.ExecuteReader Run-time exception thrown : System.InvalidOperationException -
'adsdsoobject'提供程序不支持ICommandWithParameters接口 当前提供程序不支持命令参数。
我的代码:
Dim strSql As String = "SELECT SAMACCOUNTNAME, DISPLAYNAME, DEPARTMENT FROM 'LDAP://xxx.com.my' WHERE ObjectClass='user' AND EXTENSIONATTRIBUTE8 = 'PM' AND DISPLAYNAME = ? ORDER BY DISPLAYNAME "
glConnection = New OleDbConnection("Provider=adsdsoobject;User Id=xxx.com.my\UAMTEAM;Password=" + ClsGlobal.Decrypt(strpwd) + ";")
glCommand = New OleDbCommand(strSql, glConnection)
' Add the input parameter and set its properties.
Dim parameter As New OleDbParameter()
parameter.ParameterName = "@param2"
parameter.OleDbType = OleDbType.VarChar
parameter.Direction = ParameterDirection.Input
parameter.Value = param1
' Add the parameter to the Parameters collection.
glCommand.Parameters.Add(parameter)
glConnection.Open()
glReader = glCommand.ExecuteReader