I have a dataset and i want to filter it into a new dataset or reader. I
have the following code below but do not know how to finish it. I want to
inport all rows where the TypeName column = a certain value (premier plus)
Some help would be appreciated:)

Dim links As New DNSite.LinksDB()

Dim myDS As DataSet

myDS = links.GetLinks(CatID)

' filter dataset for premier plus links
' and bind to the datalist control

Dim pluslinks As New DataSet()

pluslinks.Tables.Add(myDS.Tables("tblLinks").Clone)

pluslinks.Tables(0).ImportRow(myDS.Tables("tblLinks").???

filter dataset?? by srinivas

srinivas
Mon Jul 28 06:11:37 CDT 2003

Hi john,
Here is the code which updates to a RowsCollection from a
DataSet. Basically, what you are looking for is to filter
the rows from a Dataset and store that in a DataSet. If,
what i understood is correct, here is the similar sort of
code which just filters some records from the DataTable on
filtering to different DataRows collection.

'Assume we have a DataTable Dt
'Dim strExpr As String
'Dim FilteredRows() As DataRow
'strExpr = "RegistrationDate >= #12/10/2002# and
RegistrationDate <= #" + Date.Today().ToShortDateString
+ "#"
-- put the filtered expression into a DataRows Collection
'FilteredRows = Dt.Select(strExpr)
--
Hope this might solve your problem.
If you have any queries, always welcome.
Thanks
srinivas moorthy



>-----Original Message-----
>I have a dataset and i want to filter it into a new
dataset or reader. I
>have the following code below but do not know how to
finish it. I want to
>inport all rows where the TypeName column = a certain
value (premier plus)
>Some help would be appreciated:)
>
>Dim links As New DNSite.LinksDB()
>
>Dim myDS As DataSet
>
>myDS = links.GetLinks(CatID)
>
>' filter dataset for premier plus links
>' and bind to the datalist control
>
>Dim pluslinks As New DataSet()
>
>pluslinks.Tables.Add(myDS.Tables("tblLinks").Clone)
>
>pluslinks.Tables(0).ImportRow(myDS.Tables("tblLinks").???
>
>
>
>
>.
>

Re: filter dataset?? by Steve

Steve
Mon Jul 28 06:14:37 CDT 2003

Does this help :

YourDataSet.Tables[0].Select("Col = value")

This will return a datatable.




"John Pether" <john@john.com> wrote in message
news:eJFUGqOVDHA.1480@tk2msftngp13.phx.gbl...
> I have a dataset and i want to filter it into a new dataset or reader. I
> have the following code below but do not know how to finish it. I want to
> inport all rows where the TypeName column = a certain value (premier plus)
> Some help would be appreciated:)
>
> Dim links As New DNSite.LinksDB()
>
> Dim myDS As DataSet
>
> myDS = links.GetLinks(CatID)
>
> ' filter dataset for premier plus links
> ' and bind to the datalist control
>
> Dim pluslinks As New DataSet()
>
> pluslinks.Tables.Add(myDS.Tables("tblLinks").Clone)
>
> pluslinks.Tables(0).ImportRow(myDS.Tables("tblLinks").???
>
>
>
>



Re: filter dataset?? by Steve

Steve
Mon Jul 28 08:41:30 CDT 2003

You can bind to a DATAVIEW,


When binding, bind to the DEFAULTVIEW, them set a row filter on this view.

myDS.Tables[0].Select("TypeName=Premier"') will return a DATATABLE with the
rows in that match the filter, but if its just for binding why bother
creating a new dataset with a new table, why not just bind to a dataview.

Cheers

Steve


"John Pether" <john@john.com> wrote in message
news:eM89J0PVDHA.2344@TK2MSFTNGP09.phx.gbl...
> Are you saying that instead of filtering the full dataset to another
dataset
> and dinding it to the datalist, I can just filter the master dataset and
> bind that to the datalist?
>
> so if I have a datalist plusDL I could do this??? Actually, tried that and
> it doesn't work...LOL
>
> plusdl.DataSource = myDS.Tables[0].Select("TypeName=Premier")
>
> I presume <code>myDS.Tables[0].Select("TypeName=Premier"')</code> selects
> all rows that contain TypeName=Premier???...hmmmm getting confused now
>
> Thx for your help:):)
>
>
>
>
> "Steve Drake" <Steve@_NOSPAM_Drakey.co.uk> wrote in message
> news:eCSdxlPVDHA.2192@TK2MSFTNGP10.phx.gbl...
> > Does this help :
> >
> > YourDataSet.Tables[0].Select("Col = value")
> >
> > This will return a datatable.
> >
> >
> >
> >
> > "John Pether" <john@john.com> wrote in message
> > news:eJFUGqOVDHA.1480@tk2msftngp13.phx.gbl...
> > > I have a dataset and i want to filter it into a new dataset or reader.
I
> > > have the following code below but do not know how to finish it. I want
> to
> > > inport all rows where the TypeName column = a certain value (premier
> plus)
> > > Some help would be appreciated:)
> > >
> > > Dim links As New DNSite.LinksDB()
> > >
> > > Dim myDS As DataSet
> > >
> > > myDS = links.GetLinks(CatID)
> > >
> > > ' filter dataset for premier plus links
> > > ' and bind to the datalist control
> > >
> > > Dim pluslinks As New DataSet()
> > >
> > > pluslinks.Tables.Add(myDS.Tables("tblLinks").Clone)
> > >
> > > pluslinks.Tables(0).ImportRow(myDS.Tables("tblLinks").???
> > >
> > >
> > >
> > >
> >
> >
>
>