Hi,

I'm trying to use the RowFilter property...but with no luck...

Dim pdstSample As New DataSet
pdstSample.Tables.Add(New DataTable("tblSample"))
Dim pdtbSample As DataTable = pdstSample.Tables(0)
pdtbSample.Columns.Add(New DataColumn("fldSample"))
Dim pdrwSample As DataRow = pdtbSample.NewRow()
pdrwSample(0) = "Sample"
pdtbSample.Rows.Add(pdrwSample)
pdrwSample = pdtbSample.NewRow()
pdrwSample(0) = "Elpmas"
pdtbSample.Rows.Add(pdrwSample)
Dim pdvwSample As New DataView(pdtbSample)
MsgBox(pdvwSample.Table.Rows.Count)
pdvwSample.RowFilter = "fldSample = 'Sample'"
MsgBox(pdvwSample.Table.Rows.Count)


The two msgbox lines return 2 even though it should filter 1 row...please
help.......

Jag

Re: Problem with DataView.RowFilter Property (.NET Framework) by Miha

Miha
Thu Aug 19 02:33:21 CDT 2004

Hi Jason,

You should check DataView's properties and not underlying DataTable ones.
MsgBox(pdvwSample.Count)

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com


"Jason Taylor" <JasonTaylor@discussions.microsoft.com> wrote in message
news:B41EDB7C-BEC2-49F0-A30C-A31B92FB1F26@microsoft.com...
> Hi,
>
> I'm trying to use the RowFilter property...but with no luck...
>
> Dim pdstSample As New DataSet
> pdstSample.Tables.Add(New DataTable("tblSample"))
> Dim pdtbSample As DataTable = pdstSample.Tables(0)
> pdtbSample.Columns.Add(New DataColumn("fldSample"))
> Dim pdrwSample As DataRow = pdtbSample.NewRow()
> pdrwSample(0) = "Sample"
> pdtbSample.Rows.Add(pdrwSample)
> pdrwSample = pdtbSample.NewRow()
> pdrwSample(0) = "Elpmas"
> pdtbSample.Rows.Add(pdrwSample)
> Dim pdvwSample As New DataView(pdtbSample)
> MsgBox(pdvwSample.Table.Rows.Count)
> pdvwSample.RowFilter = "fldSample = 'Sample'"
> MsgBox(pdvwSample.Table.Rows.Count)
>
>
> The two msgbox lines return 2 even though it should filter 1 row...please
> help.......
>
> Jag



Re: Problem with DataView.RowFilter Property (.NET Framework) by JasonTaylor

JasonTaylor
Thu Aug 19 17:11:02 CDT 2004

Thankyou, much appreciated. :)

"Miha Markic [MVP C#]" wrote:

> Hi Jason,
>
> You should check DataView's properties and not underlying DataTable ones.
> MsgBox(pdvwSample.Count)
>
> --
> Miha Markic [MVP C#] - RightHand .NET consulting & development
> miha at rthand com
> www.rthand.com
>
>
> "Jason Taylor" <JasonTaylor@discussions.microsoft.com> wrote in message
> news:B41EDB7C-BEC2-49F0-A30C-A31B92FB1F26@microsoft.com...
> > Hi,
> >
> > I'm trying to use the RowFilter property...but with no luck...
> >
> > Dim pdstSample As New DataSet
> > pdstSample.Tables.Add(New DataTable("tblSample"))
> > Dim pdtbSample As DataTable = pdstSample.Tables(0)
> > pdtbSample.Columns.Add(New DataColumn("fldSample"))
> > Dim pdrwSample As DataRow = pdtbSample.NewRow()
> > pdrwSample(0) = "Sample"
> > pdtbSample.Rows.Add(pdrwSample)
> > pdrwSample = pdtbSample.NewRow()
> > pdrwSample(0) = "Elpmas"
> > pdtbSample.Rows.Add(pdrwSample)
> > Dim pdvwSample As New DataView(pdtbSample)
> > MsgBox(pdvwSample.Table.Rows.Count)
> > pdvwSample.RowFilter = "fldSample = 'Sample'"
> > MsgBox(pdvwSample.Table.Rows.Count)
> >
> >
> > The two msgbox lines return 2 even though it should filter 1 row...please
> > help.......
> >
> > Jag
>
>
>