473,396 Members | 2,013 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,396 software developers and data experts.

Dataview

Hi guys,
I need some help with Dataview. Can someone guide me as to how i can iterate
through dataview such as for each item etc. I need to look for a certain item
in a dataview.

I am using c#.

Thanks

Manny
Nov 18 '05 #1
3 1951
Don't forget the filter method of the dataview. This method allows you to
specify a criteria and just show the rows in the dataview which meet the
specified criteria.

e.g (Where oDS is a dataset)

oDS.Tables(0).DefaultView.RowFilter = "_age > 10"

In response to your original question you could go (Off the top of my head
here ;) something like this...

Dim oRow As DataRow
For Each oRow In oDV.Table.Rows
MessageBox.Show(oRow.Item("MyDatabaseField"))
Next
hth
Cheers
Mark

DataView.RowFilter
"Manny Chohan" <Ma*********@discussions.microsoft.com> wrote in message
news:FE**********************************@microsof t.com...
Hi guys,
I need some help with Dataview. Can someone guide me as to how i can iterate through dataview such as for each item etc. I need to look for a certain item in a dataview.

I am using c#.

Thanks

Manny

Nov 18 '05 #2
You can look through it via:

for (int i = 0; i < dv.Count; ++i){
DataRowView row = dv[i];
}

you can also use the RowFilter property such as:

dv.RowFilter = "ProductId = 1";

and then dv will only have rows that match that set...though it makes more
sense to use the datatable.select function...which is probably what I would
recommend...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Manny Chohan" <Ma*********@discussions.microsoft.com> wrote in message
news:FE**********************************@microsof t.com...
Hi guys,
I need some help with Dataview. Can someone guide me as to how i can iterate through dataview such as for each item etc. I need to look for a certain item in a dataview.

I am using c#.

Thanks

Manny

Nov 18 '05 #3
thanks....it worked

"Karl Seguin" wrote:
You can look through it via:

for (int i = 0; i < dv.Count; ++i){
DataRowView row = dv[i];
}

you can also use the RowFilter property such as:

dv.RowFilter = "ProductId = 1";

and then dv will only have rows that match that set...though it makes more
sense to use the datatable.select function...which is probably what I would
recommend...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Manny Chohan" <Ma*********@discussions.microsoft.com> wrote in message
news:FE**********************************@microsof t.com...
Hi guys,
I need some help with Dataview. Can someone guide me as to how i can

iterate
through dataview such as for each item etc. I need to look for a certain

item
in a dataview.

I am using c#.

Thanks

Manny


Nov 18 '05 #4

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

Similar topics

0
by: RPI_alum | last post by:
I've been experiencing some frustrating behavior that I believe may be a MS bug in the Framework. Has anyone else experienced this, know a better way to resolve it, or if it is an actual MS bug ...
9
by: jwedel_stolo | last post by:
Hi I'm creating a dataview "on the fly" in order to sort some data prior to writing out the information to a MS SQL table I have used two methods in order to determine the sort order of the...
4
by: Martin Schmid | last post by:
I am trying to implement a DataView for a DataGrid so I can sort at runtime by clicking on column headers. My initial page load works... it displays the data However, when I click a column...
2
by: Alpha | last post by:
I have a window application. In one of the form, a datagrid has a dataview as its datasource. Initial filtering result would give the datavew 3 items. When I double click on the datagrid to edit...
36
by: kjvt | last post by:
Based on a prior posting, I've written a function to convert a recordset to a dataview. The first call to the function for a given recordset works perfectly, but the second call always returns a...
13
by: Steve | last post by:
I have a form with a dataset and a datagrid. I created a dataview on this dataset. When the user modifies the datagrid, I look up this record in the dataview to make sure it is unique. Here is...
5
by: David Wender | last post by:
I want to create a dataview with a sort on multiple columns. However, when I use FindRows, I only want to search some of the columns, not all. Is this possible? I have not been able to make it...
3
by: astro | last post by:
I have a datagrid that is two levels down from the dataview (i.e. grandchild). I have spent 3 hours trying to get the syntax of determining it's real datasource (i.e. not it's source based on it's...
5
by: enceladus311 | last post by:
I'm trying to find a way to keep from having to fill a DataView after every PostBack to a page. Basically, the design is that I have a DataView that I fill, which I then set as the DataSource to a...
0
by: Pravin Pujari | last post by:
Hi All, I am using .net framework 1.1 and c#. I have one problem regarding dataview. I have one dataview to which sorting may be applied or may not be applied. I have one UI component where I...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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
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...
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,...

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.