FIX: ADO Filter Fails if Filter String Contains '*strval'ID: Q181487
|
Receiving error 3001 using an ADODB.Recordset when the filter string contains '*stringvalue' pattern for the string column even if the operator is '='.
The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another.
This bug was corrected in ActiveX Data Objects (ADO) version 2.0.
Put_Filter fails if the filter string contains '*stringvalue' pattern for the string column even if the operator is an '='. It should not fail. It acts like the LIKE syntax.
Sub FilterEqualFails()
Dim conn As New Connection
Dim rs As New Recordset
conn.Open "<DSN_Name>", "sa", ""
On Error Resume Next
conn.Execute "drop table Foo"
On Error GoTo errh
conn.Execute "create table Foo(id int primary key,f1 " & _
"varchar(200), f2 binary(200))"
rs.Open "select * from Foo", conn, adOpenKeyset, adLockOptimistic
rs.AddNew
rs("id") = 1
rs("f1") = "*x Hello world"
rs.Update
rs.Requery
rs.filter = "f1 = '*x Hello world'"
Exit Sub
errh:
Debug.Print "Error:", Err, Hex(Err)
Debug.Print "Source:", Err.Source
Debug.Print "Desc:", Err.Description
End Sub
When you execute this code, you expect it to find the row with the value.
However, this is the output received when you execute the code:
Error: 3001 BB9
Source: ADODB.Recordset
Additional query words:
Keywords : kbADO kbADO150bug kbADO200fix kbDatabase
Version : WINDOWS:1.5
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: July 14, 1999