Dataview

G

Guest

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
 
J

John

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
 
K

Karl Seguin

You can look through it via:

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

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
 
G

Guest

thanks....it worked

Karl Seguin said:
You can look through it via:

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

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 said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,294
Latest member
LandonPigo

Latest Threads

Top