473,399 Members | 4,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

querying data from a dataset?

MDB
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, to deal with all the
changes the data must go through on screen depending on the state and value
of several dropdown controls? It seems to me that that would be a little
more efficient than having about a dozen stored procedures and re-querying
the SQL table on every changed event. If the answer is yes, how do I go
about pulling a subset from a dataset in memory?

If the answer is no, or if the answer is that I'm better off with the stored
procedures, I'm okay with that. Just checking to see if there's Another Way.
Thanks!

MD Bloemker
md********@hotmail.com
Nov 18 '05 #1
3 1562
If I understand you correctly, you want to get one dataset and then filter
it for different uses?

If so, you can create a DataView and apply SQL-like syntax to it:

Private Sub MakeDataView()
Dim dv As DataView
dv = New DataView
With dv
.Table = DataSet1.Tables("Suppliers")
.AllowDelete = True
.AllowEdit = True
.AllowNew = True
.RowFilter = "City = 'Berlin'"
.RowStateFilter = DataViewRowState.ModifiedCurrent
.Sort = "CompanyName DESC"
End With

' Simple bind to a TextBox control
Text1.DataBindings.Add("Text", dv, "CompanyName")
End Sub

http://msdn.microsoft.com/library/de...iltertopic.asp

"MDB" <md*@hotmail.com> wrote in message
news:ab********************@telcove.net...
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, to deal with all
the
changes the data must go through on screen depending on the state and
value
of several dropdown controls? It seems to me that that would be a little
more efficient than having about a dozen stored procedures and re-querying
the SQL table on every changed event. If the answer is yes, how do I go
about pulling a subset from a dataset in memory?

If the answer is no, or if the answer is that I'm better off with the
stored
procedures, I'm okay with that. Just checking to see if there's Another
Way.
Thanks!

MD Bloemker
md********@hotmail.com


Nov 18 '05 #2
Your best bet is to use the Select method for the DataTable.

SqlDataAdapter.Fill( table );

DataRow [] rows = table.Select( "journalid = " + ddlJournalID.SelectedValue
+ " AND "Type = " + ddlType.SelectedValue );

You can then bind rows to what ever you want.

Or if you need more control, you can look into building a DataView using the
DataTable as backing.

HTH,

bill

"MDB" <md*@hotmail.com> wrote in message
news:ab********************@telcove.net...
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, to deal with all the changes the data must go through on screen depending on the state and value of several dropdown controls? It seems to me that that would be a little
more efficient than having about a dozen stored procedures and re-querying
the SQL table on every changed event. If the answer is yes, how do I go
about pulling a subset from a dataset in memory?

If the answer is no, or if the answer is that I'm better off with the stored procedures, I'm okay with that. Just checking to see if there's Another Way. Thanks!

MD Bloemker
md********@hotmail.com

Nov 18 '05 #3
Yes, you can query a datatable in a dataset with method Select. Whoever, I
would still recommend querying the database. That is what it is there for.
And you would end up with less code.

Eliyahu

"MDB" <md*@hotmail.com> wrote in message
news:ab********************@telcove.net...
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, to deal with all the changes the data must go through on screen depending on the state and value of several dropdown controls? It seems to me that that would be a little
more efficient than having about a dozen stored procedures and re-querying
the SQL table on every changed event. If the answer is yes, how do I go
about pulling a subset from a dataset in memory?

If the answer is no, or if the answer is that I'm better off with the stored procedures, I'm okay with that. Just checking to see if there's Another Way. Thanks!

MD Bloemker
md********@hotmail.com

Nov 18 '05 #4

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

Similar topics

17
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...
3
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...
2
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....
1
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...
6
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...
1
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...
1
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...
5
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...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.