Need help. Cannot get typed data row when filterring with DataView.

K

Ken Varn

I have a typed DataSet generated from an XSD file in which I am trying to
filter the data with a DataView. I get the DataSet.DefaultView object and
setup my filters. The only problem is, that the DataView collection does
not have a collection of my typed row. I can only can work on a collection
of typed DataRows from the DataView collection. Is there anyway to filter a
typed DataSet using a typed DataView?

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
 
W

William Ryan eMVP

Hi Ken:
Ken Varn said:
I have a typed DataSet generated from an XSD file in which I am trying to
filter the data with a DataView. I get the DataSet.DefaultView object and
setup my filters. The only problem is, that the DataView collection does
not have a collection of my typed row. I can only can work on a
collection
How are you determing this? You can definitely use the RowFilter to filter
a dataview based on a strongly typed dataset
of typed DataRows from the DataView collection. Is there anyway to filter a
typed DataSet using a typed DataView?
Yes,
Look at this code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load


SqlDataAdapter1.Fill(DataSet11.Tbl_Facilities)

dv = DataSet11.Tbl_Facilities.DefaultView

DataGrid1.DataSource = dv

MessageBox.Show(dv.Count.ToString) ' Shows 55 (all records)

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

dv.RowFilter = "Dept_Number > 20"

MessageBox.Show(dv.Count.ToString) 'Shows 41 (only records with dept above
20

End Sub
 

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

Top