473,657 Members | 2,432 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Querying the data in a DataSet in C#

I have three weeks of history for all user accounts stored in a DataSet (dsAccountsHist ory). 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 dsAccountsHisto ry where dsAccountsHisto ry.custId=targe tId" 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
Jul 21 '05 #1
34 18367
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*@LiveComput ers.com> wrote in message
news:8F******** *************** ***********@mic rosoft.com...
I have three weeks of history for all user accounts stored in a DataSet (dsAccountsHist ory). 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 dsAccountsHisto ry where dsAccountsHisto ry.custId=targe tId" 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

Jul 21 '05 #2
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
Jul 21 '05 #3
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*@LiveComput ers.com> wrote in message
news:8F******** *************** ***********@mic rosoft.com...
I have three weeks of history for all user accounts stored in a DataSet (dsAccountsHist ory). 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 dsAccountsHisto ry where dsAccountsHisto ry.custId=targe tId" 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

Jul 21 '05 #4
Cor <no*@non.com> wrote:
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.


That assumes that he only *ever* needs the information for the one
user. The way I read the question, the OP already has the information
for all users for other parts of his app, and doesn't want to have to
go back to the database to fetch data he's already got, just for the
purposes of filtering.

I don't think that's bad design at all.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #5
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
Jul 21 '05 #6
Cor
Hi Jon,

You are free to think that, in my opinion it is using a SQL database as a
papertape.

The only situation I can think of this situation as not bad desing are pda
solutions with a disconnected dataset on it.

Cor
Jul 21 '05 #7
Cor <no*@non.com> wrote:
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.


That assumes that he only *ever* needs the information for the one
user. The way I read the question, the OP already has the information
for all users for other parts of his app, and doesn't want to have to
go back to the database to fetch data he's already got, just for the
purposes of filtering.

I don't think that's bad design at all.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #8
Cor <no*@non.com> wrote:
You are free to think that, in my opinion it is using a SQL database as a
papertape.

The only situation I can think of this situation as not bad desing are pda
solutions with a disconnected dataset on it.


So if you already had all the data on the desktop, you would still go
back to the database just for filtering purposes? Do you see *any*
value in DataView.RowFil ter?

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #9
Cor
Hi Jon,

You are free to think that, in my opinion it is using a SQL database as a
papertape.

The only situation I can think of this situation as not bad desing are pda
solutions with a disconnected dataset on it.

Cor
Jul 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
1223
by: Dan Koster | last post by:
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 ...
3
2293
by: C. Hughes | last post by:
I have a simple application that uses an XML file to store it's data. That means I don't have a seperate database. In order to read the data I created a DataSet that reads my XML file with the .ReadXml() method. 1. I want to manipulate the resulting dataset, preferably with SQL queries. But the documentation states that I need to have a data connection to do this. But if I am only using an XML file, how do I do this without a data...
2
2447
by: Abhishek Srivastava | last post by:
Hello All, Suppose if I have a SQL query like select p.ID, p.NAME, p.UNIT_PRICE, o.QUANTITY from PRODUCT p ORDERS o where p.ID = X AND P.ID = O.ID Here one product can have many orders. Essentially Product is the master table and Orders is the details table.
3
1577
by: MDB | last post by:
I'd normally Google for a question like this, and hope to snag a few examples along with the answer, but this time I can't see to get the keywords specific enough. Or I'd ask coworkers, but they're just as new to ASP.NET as I am. Is it possible to have a dataset filled with all the records in an SQL table (on the small side, maybe three hundred records total), and then query that table for subsets of data, e.q. a simple WHERE clause,...
1
2315
by: Michel Moreno | last post by:
Hi everybody, i would like to query the Index Catalog, for a site, as describe in the article: http://support.microsoft.com/default.aspx?scid=kb;en-us;820105 But i'm having an error, I don't know what to do. Please help me. Thanx in advanced. Michel Here is the error. Server Error in '/' Application.
6
316
by: Fred | last post by:
I want to use a dataset so that I can obtain data from a number of sources and put it into one table. Using dataadaptors this seems to work well. Now I have a table (Forecast) in the dataset with columns: Rep, Area, Period, Qty. I want to display this data on a datagrid like: Rep, Period1_Qty, Period2_Qty, .. Period7_Qty where the period1_Qty is the sum of the Qtys for that Rep and for a
1
8318
by: Job Lot | last post by:
i am querying excel file as follows Dim conn As New OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; " & _ "data source='" & "C:\Temp\SSPortfolio.xls" & " '; " & _ "Extended Properties=Excel 8.0;" & "HDR=Yes;" & "IMEX=1") '! Select the data from Sheet1 of the workbook.
1
1421
by: Ryan Ramsey | last post by:
I am looking for some advice or best practices on how to do this.. I have an XML file, that I read into a dataset via ReadXML: PlayersDataSet.Clear(); PlayersDataSet.ReadXml(filePath); What I would like to do is query the dataset so I can search for people from California, or people older than 65 or something?
5
3685
by: sql_er | last post by:
Guys, I have an XML file which is 233MB in size. It was created by loading 6 tables from an sql server database into a dataset object and then writing out the contents from this dataset into an XML file. Once my application starts, I load this XML file into a DataSet object using "ReadXML" function. This creates a dataset in memory with 6 tables.
2
1476
by: Steven Cheng [MSFT] | last post by:
Hi Cj, I also noticed that the "Act" variable here seems hasn't been declared(or declared anywhere else?). I've try building the same code and got the same result and the "Operator '+' cannot be applied to operands of type 'string' " error does pointing to the "Act.Trim" which should be of method call syntax such as Act.Trim() After change it, that error is eliminated.
0
8413
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2742
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.