开发者

Dynamic SQL on DataSet

开发者 https://www.devze.com 2023-01-11 18:02 出处:网络
I have to get a dynamically created SQL-Query to wo开发者_开发问答rk with a DataSet. I\'m using a DataSet where I store some information from the database file (MS-Access).

I have to get a dynamically created SQL-Query to wo开发者_开发问答rk with a DataSet. I'm using a DataSet where I store some information from the database file (MS-Access).

Now I want the user to be able to select special filters - and depending on them I create a SQL-Query, e.g.:

SELECT * FROM table WHERE x <> 0 AND y >= 10

The problem is, that the parameters are completely dynamic, so it could as well look like this:

SELECT * FROM table WHERE x <= 50 AND y IN (10, 50, 43)

So I can't use a TableAdapter for it. How yould I get this working?

I already came across the Select()-function of a Table adapter where I can define filter expression but I'm not quite sure how they should look like. Any help there?


Check these two links. Might help you -

http://social.msdn.microsoft.com/Forums/en-US/sqlxml/thread/4294d5bf-ae82-4326-9cf2-35f413cd7783

http://www.eggheadcafe.com/community/aspnet/2/24479/how-to-filter-dataset.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消