Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

recordset filter with unique identifiers

Status
Not open for further replies.

ChainsawJoe

Programmer
Dec 5, 2000
154
GB
hey all - I have a recordset already returned from a VB obj which I cannot change, but need to limit the records to a specific set of IDs. For this I'm using rs.filter - seems to work perfectly if I use

Code:
rs.filter = "username like 'a%'

but if I use

Code:
rs.filter = "ID in (select blahblah as ID from blah)"

where ID and blahblah are UniqueIdentifiers, then I get
Code:
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

I know the SQL specified in the filter works, since it's fine thru SQL Query Analyser.

I believe the problem to be in how uniqueidentifiers are used thru ASP. Something's not clicking here - any clues?
 
The problem is that the Filter property does not support subqueries, nor the IN operator.

To achieve your desired results, you'll need to build a filter string containing the uniqueidentifiers like so:

rs.filter = "ID=100 OR ID=200 OR ID=300 OR ID=400" Jon Hawkins
 
that's got it - superb. thanks Jon.
bit of a limitation for the whole [tt]filter[/tt] thing, huh? . . . :eek:)
 
AFAIK, the filter property was created with the intentions of providing a mechanism for conflict resolution (I could be wrong). But I agree, the usage of this property could (and should) definitely be expanded in future releases. Jon Hawkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top