TableAdapter filtering problem

G

Guest

Hi!
I need a custom filter on a TableAdapter query, which has to fill a DataTable
(VS-2005, C#). Data should be editable.

select integerfld, others
from Nap
where integerfld in (@param)

this.napTableAdapter.FillBy(this.int2006DataSet.Nap, "20,30,40,55");
Results:
error CS1503: Argument '2': cannot convert from 'string' to 'int'

OK. I tried other solutions also, charfld is a casted field in the table:

select charfld, others
from Nap
where charfld in (@param)

this.napTableAdapter.FillBy3(this.int2006DataSet.Nap, "'20','30','40','55'");

It does not return any rows.
Of course filtering data is not constant.

Anyway, how can I pass a programmatically compiled where filter to a
TableAdapter? Any field combination should be filtered.
 
G

Guest

As I searched for solution, I found, that this question is not new,
and considered FAQ, that was (I think) were not answewd.

Wayne Brantley answared a similar question on 1/23/2006 in this group.
Title was: passing parameters to filter using "IN" keyword
He suggested reading this page:
http://www.sommarskog.se/arrays-in-sql.html
I think this article is a very good startpoint for solving this problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top