473,666 Members | 2,517 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Which is Quicker? Loop or filter a dataset....

Hi - when working with datasets, is it quicker to loop through the
dataset, comparing some column values with predetermined values, or
should I apply a filter on the dataset to retrieve the values I want?

(background - I'm populating an appointment calendar for consultants,
and need to check around 30 dates at a time dates for each of the 45
consultants - so I retrieve all appointments between the start date, and
the startdate + 30 days - into the dataset - I then need to find out if
a consultant has an appointment on any date in the range, and then loop
onto the next date, and then the next consultant, and populate a table
with all of this info at once).

Thanks for any guidance,

Mark

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
3 2165
Filter.
"Mark" <no****@devdex. com> wrote in message
news:uO******** ******@TK2MSFTN GP09.phx.gbl...
Hi - when working with datasets, is it quicker to loop through the
dataset, comparing some column values with predetermined values, or
should I apply a filter on the dataset to retrieve the values I want?

(background - I'm populating an appointment calendar for consultants,
and need to check around 30 dates at a time dates for each of the 45
consultants - so I retrieve all appointments between the start date, and
the startdate + 30 days - into the dataset - I then need to find out if
a consultant has an appointment on any date in the range, and then loop
onto the next date, and then the next consultant, and populate a table
with all of this info at once).

Thanks for any guidance,

Mark

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #2
Mark,
My guess is applying a filter will be quicker...but the difference will
probably be almost unnoticeable..

My real answer is to simply test it out...you can easily build both and
check which takes longer to run (might need to do it more than 1 times
though to actually start seeing a difference)...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Mark" <no****@devdex. com> wrote in message
news:uO******** ******@TK2MSFTN GP09.phx.gbl...
Hi - when working with datasets, is it quicker to loop through the
dataset, comparing some column values with predetermined values, or
should I apply a filter on the dataset to retrieve the values I want?

(background - I'm populating an appointment calendar for consultants,
and need to check around 30 dates at a time dates for each of the 45
consultants - so I retrieve all appointments between the start date, and
the startdate + 30 days - into the dataset - I then need to find out if
a consultant has an appointment on any date in the range, and then loop
onto the next date, and then the next consultant, and populate a table
with all of this info at once).

Thanks for any guidance,

Mark

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #3
"Mark" <no****@devdex. com> wrote in message
news:uO******** ******@TK2MSFTN GP09.phx.gbl...
Hi - when working with datasets, is it quicker to loop through the
dataset, comparing some column values with predetermined values, or
should I apply a filter on the dataset to retrieve the values I want?


The simple answer is, "it depends". ;-)

You are talking about a very small amount of data, all of which will be in
memory. Chances are that nobody will ever notice the difference in
performance between the best case and the worst case. Consider: what if one
technique took 0.001 seconds and another took 1 second? In a web-based
application, the time it takes to send the HTML to the client will be large
enough that nobody will notice the difference.

John Saunders
Nov 18 '05 #4

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

Similar topics

13
2198
by: Chris Mantoulidis | last post by:
There must be some tips to make a program quicker. I guess more than 50% of ppl here will say "avoid the if-s". Yeah I know this makes a program quicker but some times an "if" is inevitable, isn't it? What are some tips to make a program quicker? TIA, cmad
1
8797
by: SPG | last post by:
Hi, I need to be able to filter the columns that are visible through a dataset. That is, I can have all columns in a dataset, but only some of them are visible when filtered. I know you can use rowfilter on a dataview. Is there anything like that I can use? Steve
1
1739
by: werk | last post by:
For limiting access to the database to strictly necessary I try to filter the query by using DataView. Thw DataSet ds contains three columns (fields) : (LAND_ID, Landcode, Landnaam) and four rows. I try to filter out only one country (key is LAND_ID) with the following code: DataTable dt = ds.Tables; // ds contains the dataset of the query 4 rows
3
11444
by: Vern | last post by:
The following code retrieves data into a dataset, and then creates a dataview with a filter. This dataview is then attached to a combobox. When the effective date changes, I would like to see the newly filtered data without having to create a new dataview each time. Is that possible? Also, do I need to attach the dataview to the combo box each time? if (AgencyCounties == null || sPropertyState.Text != prevPropertyState) {...
5
1938
by: Helixpoint | last post by:
Here is my code: Dim availMach As New ASPNETProduct.machinedb() Dim dstMachList As DataSet dstMachList = availMach.GetAvailMach(theSearchVal, theSearchBy, theMachCode1, theSearchView, SelSort, SelSortDir) availMachList.DataSource = dstMachList
4
22124
by: CMW | last post by:
In VB.NET I'm retrieving a single table from a SQL Server (tblformdata). I need to search each record in the dataset to see if any data is missing from the records (i.e., missing first name, missing last name, missing city, missing state, missing zip, etc.). If I find that a column data is missing from a record (i.e., last name), I'd like to update a column/field with a code indicating data is missing (i.e., ErrorCode = 100). Later, another...
1
1396
by: cksj | last post by:
I was assigned to a project where the main database is XML files instead of RDBMS. One of my primary responsibilities is to create Crystal Reports using ..Net. We are having performance issues when we open and view reports. The reason is because Crystal Report that uses XML as a data source pulls all of the data into the report and I just have a filter inside the report. The XML files are loaded into a strong-typed dataset. Then this...
2
8832
by: Anandan | last post by:
Hi, In our Project we use Dataset to load the Grid with Values. We have some criteria to filter the values to be shown in the Grid. For that we used the SELECT command to filter the Same Dataset. The SELECT Command we are using is as follows DS.Tables(0).Select("FieldName = '" & input value & "')
16
6302
by: fniles | last post by:
I am using VB.NET 2003, SQL 2000, and SqlDataAdapter. For every record in tblA where colB = 'abc', I want to update the value in colA. In VB6, using ADO I can loop thru the recordset,set the values of colA and call the Update method. How can I do this in VB.NET and SqlDataAdapter ? Thank you. m_cmdSQL = New SqlClient.SqlCommand With m_cmdSQL .Connection = adoCon
0
8454
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
8878
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
7389
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5671
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
4200
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...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2776
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
2012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1778
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.