none
Tableadapter SQL query help (Where [column] IN set) RRS feed

  • Question

  • I Need help on how to properly form and use the command SELECT * FROM [Table] WHERE [column] IN (filter set).

    I have a typed database and trying to use a tableadapter to load the information in to the dataset. As the database gets bigger, I was hoping to filter the returned data instead of loading the whole thing into memory. I thought that you could limit the returned dataset by using the WHERE [column] IN (set), where set is the filter critera. I'm having problems forming the correct argument:

    Database: Access

    Tableadapter command is: SELECT * FROM BillingAccount WHERE ([BillingID] IN (?))

    I can't seem to pass in more than one argument. It works if I pass in a valid BillingID such as '32', but can't pass a set of search criteria like '32, 45, 66' which you're supposed to be able to do. How do I rewrite the command to accept a set of Int32 to filter?
    Tuesday, December 18, 2007 7:53 AM

All replies

  • You cannot pass values into IN as single parameter. You need to implement some sort of workaround to be able to pass array of values. See my KB article about how I have done it

     

    http://support.microsoft.com/kb/555266

     

    Tuesday, December 18, 2007 11:30 AM
    Moderator
  • Unfortunately I'm using Access DB so I don't think that will work.

     

    However, that gives me an idea to extend the tableadapter class and pass in an array parameter instead...

     

    Saturday, December 22, 2007 12:57 AM