Dataview

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
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
 
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
 
Back
Top