在C#中查询DataSet中的数据 [英] Querying the data in a DataSet in C#
问题描述
对于存储在DataSet(dsAccountsHistory)中的所有用户帐户,我有三周的历史记录。我希望能够在运行时将这些数据缩小到一个特定用户,而无需再次对dadabase进行往返。我希望能够使用像select * from dsAccountsHistory这样的SQL命令来执行此操作,其中dsAccountsHistory.custId = targetId"但DataAdapter只允许您连接到数据库,而不是DataSet。任何建议
如果您回复代码示例,C#是我的语言,但VB.Net也可以。
谢谢
Dan
I have three weeks of history for all user accounts stored in a DataSet (dsAccountsHistory). I want to be able to narrow that data down to one specific user, at runtime, without having to make another round-trip to the dadabase. I would love to be able to do it with an SQL command like "select * from dsAccountsHistory where dsAccountsHistory.custId=targetId" but a DataAdapter only lets you connect to a database, not a DataSet. Any suggestions
If you respond with code samples, C# is my perfered language but VB.Net is ok too
Thanks
Dan
推荐答案
使用DataView可以分类,搜索和过滤
DataTable的内容。
http://msdn.microsoft.com/library/de...classtopic.asp
-
Rob Windsor [MVP-VB]
G6咨询
加拿大多伦多
" Dan Koster" < Da*@LiveComputers.com>在消息中写道
新闻:8F ********************************** @ microsof t.com ...
Use a DataView which lets you sort, search and filter the contents of a
DataTable.
http://msdn.microsoft.com/library/de...classtopic.asp
--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
"Dan Koster" <Da*@LiveComputers.com> wrote in message
news:8F**********************************@microsof t.com...
我有一个存储在DataSet
(dsAccountsHistory)中的所有用户帐户的三周历史记录。我希望能够在运行时将这些数据缩小到一个特定用户,而无需再次往返于
dadabase。我希望能够使用SQL命令来执行此操作,例如从dsAccountsHistory中选择
*,其中dsAccountsHistory.custId = targetId"但是一个
DataAdapter只允许你连接数据库,而不是数据集。任何
建议?
如果您回复代码示例,C#是我的语言,但VB.Net也是
ok。
谢谢,
Dan
I have three weeks of history for all user accounts stored in a DataSet (dsAccountsHistory). I want to be able to narrow that data down to one
specific user, at runtime, without having to make another round-trip to the
dadabase. I would love to be able to do it with an SQL command like "select
* from dsAccountsHistory where dsAccountsHistory.custId=targetId" but a
DataAdapter only lets you connect to a database, not a DataSet. Any
suggestions?
If you respond with code samples, C# is my perfered language but VB.Net is ok too.
Thanks,
Dan
嗨Dan,
在我看来,这是一个糟糕的设计,因为它可以从中读取无用的数据串
a SQLServer并且破坏了它的性能和
连接,而你只需要一个用户的数据。
只是我的想法,
Cor
Hi Dan,
In my opinion is this a bad design isue to read useless bunches of data from
a SQLServer and spoiling with that the performance from that and the
connections while you only needs the data of one user.
Just my thought,
Cor
使用DataView,它可以让你对
DataTable。
http://msdn.microsoft.com/library/de...classtopic.asp
- -
Rob Windsor [MVP-VB]
G6咨询
加拿大多伦多
" ; Dan Koster < Da*@LiveComputers.com>在消息中写道
新闻:8F ********************************** @ microsof t.com ...
Use a DataView which lets you sort, search and filter the contents of a
DataTable.
http://msdn.microsoft.com/library/de...classtopic.asp
--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
"Dan Koster" <Da*@LiveComputers.com> wrote in message
news:8F**********************************@microsof t.com...
我有一个存储在DataSet
(dsAccountsHistory)中的所有用户帐户的三周历史记录。我希望能够在运行时将这些数据缩小到一个特定用户,而无需再次往返于
dadabase。我希望能够使用SQL命令来执行此操作,例如从dsAccountsHistory中选择
*,其中dsAccountsHistory.custId = targetId"但是一个
DataAdapter只允许你连接数据库,而不是数据集。任何
建议?
如果您回复代码示例,C#是我的语言,但VB.Net也是
ok。
谢谢,
Dan
I have three weeks of history for all user accounts stored in a DataSet (dsAccountsHistory). I want to be able to narrow that data down to one
specific user, at runtime, without having to make another round-trip to the
dadabase. I would love to be able to do it with an SQL command like "select
* from dsAccountsHistory where dsAccountsHistory.custId=targetId" but a
DataAdapter only lets you connect to a database, not a DataSet. Any
suggestions?
If you respond with code samples, C# is my perfered language but VB.Net is ok too.
Thanks,
Dan
这篇关于在C#中查询DataSet中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!