473,795 Members | 3,331 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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********@hotm ail.com
Nov 18 '05 #1
3 1580
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 = DataViewRowStat e.ModifiedCurre nt
.Sort = "CompanyNam e DESC"
End With

' Simple bind to a TextBox control
Text1.DataBindi ngs.Add("Text", dv, "CompanyNam e")
End Sub

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

"MDB" <md*@hotmail.co m> wrote in message
news:ab******** ************@te lcove.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********@hotm ail.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.Se lectedValue
+ " AND "Type = " + ddlType.Selecte dValue );

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.co m> wrote in message
news:ab******** ************@te lcove.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********@hotm ail.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.co m> wrote in message
news:ab******** ************@te lcove.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********@hotm ail.com

Nov 18 '05 #4

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
2299
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
2451
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.
1
2320
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
8325
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
1427
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
3689
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
1482
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
9672
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
9519
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
10435
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...
0
10213
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10000
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...
1
7538
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6779
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
5436
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...
2
3721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.