在填充tableadapter之前进行过滤
因此,我有一个数据集来查询Oracle数据库上的表。桌子很大,有350万个条目。但是,在代码后面,我在几百个必要条目上过滤了此表。
AgileDataSet agileDataSet = new AgileDataSet();
AgileDataSetTableAdapters.UserDataTableAdapter userDataTableAdapter = new AgileDataSetTableAdapters.UserDataTableAdapter();
userDataTableAdapter.Fill(agileDataSet.UserData);
var l=agileDataSet.UserData.Where(x=>x.ID==1234);
由于大量条目,fill()
方法永远需要。有没有办法在运行时为填充方法添加条件。在数据集设计器中的TableAdapter的SQL语句中添加永久,其中
子句不是一个选项,因为我不知道需要哪些元素。
So i have a DataSet to query a table on an Oracle Database. The table is very large and has 3.5 million entries. However later in the code I filter this table on a few hundred entries that are necessary.
AgileDataSet agileDataSet = new AgileDataSet();
AgileDataSetTableAdapters.UserDataTableAdapter userDataTableAdapter = new AgileDataSetTableAdapters.UserDataTableAdapter();
userDataTableAdapter.Fill(agileDataSet.UserData);
var l=agileDataSet.UserData.Where(x=>x.ID==1234);
Due to the large amount of entries the Fill()
method takes forever. Is there a way to add a conditions to the fill method at runtime. Adding a permanent WHERE
clause to the TableAdapter's SQL Statement in the DataSet Designer is not an option, because I do not know beforehand which elements are needed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,所以我实现了一个黑客的“解决方案”,并为TableAdapter创建了一个新的部分类别。在此类中,我生成了一个改编的
fill
函数,只要我需要在我的数据表中获取整个dbtable的一个子集,此功能将C_ICS列表作为附加输入,并在其中添加一个条件用于标准填充功能的基本通信文本。
称其看起来像这样:
我相信有一个更好的解决方案,但这就是我到目前为止的一切
Ok so I implemented a hacky "solution" and created a new partial class for the TableAdapter. In this class I generated an adapted
Fill
-Function to use whenever I need to get a subset of the whole DBTable in my DataTableThis function takes a list of c_ics as additional input and adds a where condition to the base commanttext used for the standard fill function.
Calling it would look sth like this:
I am sure that there is a better solution to this, but that is all I got so far