s_monani
asked on
ADO Recordset Filter using IN Clause
Hi
I am using Microsoft ADO Object library 2.5 in my Visual Basic project. I am facing the problem using filter method when i am specifying IN clause. If ADO filter supports IN clause then can u please send some examples.
my code is something like this:
rs.Filter = "ID in (22,23,25)"
where ID is number field.
I am using Microsoft ADO Object library 2.5 in my Visual Basic project. I am facing the problem using filter method when i am specifying IN clause. If ADO filter supports IN clause then can u please send some examples.
my code is something like this:
rs.Filter = "ID in (22,23,25)"
where ID is number field.
ASKER
The list which i want to compare is very long. Not possible with an OR operator which is y i want to use an IN clause
Perhaps you should consider then closing your recordset and rebuild the sql-query
rs.close
strSql = "Select * from YourTable where ID in (22,23,25)"
rs.Open strSql, YourConnection, adOpenDynamic, adLockPessimistic
rs.close
strSql = "Select * from YourTable where ID in (22,23,25)"
rs.Open strSql, YourConnection, adOpenDynamic, adLockPessimistic
ASKER
I dont want a where clause. i want to incorporate IN clause using recordset.filter
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Mine and Dhaest are the only two options. I would use Dhaest's idea. The filter option is slow by comparison to the sql option. especially if you have a lot of conditions.
Is there some reason you are not stating that you don't want to use the sql method?
Bob
Is there some reason you are not stating that you don't want to use the sql method?
Bob
Bob