G
Guest
Hi,
I want to fill a dataset with only some records. How can I add a filter
in the dataadapter?
I want to fill a dataset with only some records. How can I add a filter
in the dataadapter?
Miha Markic said:Hi Roby,
You can create whatever select commands (that dataadapter use) you want.
The actual syntax depends on the database used.
--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
Roby Eisenbraun Martins said:Hi,
I want to fill a dataset with only some records. How can I add a filter
in the dataadapter?
Roby Eisenbraun Martins said:Hi,
I have a data adapter to populate my dataset already. Can I use the same
one? I don't want to create the query again. I just want to add a filter, but
for the data adapter.
Miha Markic said:Hi Roby,
You can create whatever select commands (that dataadapter use) you want.
The actual syntax depends on the database used.
--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
Roby Eisenbraun Martins said:Hi,
I want to fill a dataset with only some records. How can I add a filter
in the dataadapter?
David W. Rogers said:Hi Roby. Yeah, it's pretty simple to do this, if you want the data adapter to
get a set of results and you want to filter out some of those. Try setting
the RowFilter property on the default view for the table before using the
table (or the view) as a datasource. E.g.;
DataView contactInfoView = dtContactInfo.DefaultView;
contactInfoView.Sort = "ContactID, Seq";
contactInfoView.RowFilter = "Parent.ActiveSeq = Seq";
this.dataGrid2.DataSource = contactInfoView;
David
Roby Eisenbraun Martins said:Hi,
I have a data adapter to populate my dataset already. Can I use the same
one? I don't want to create the query again. I just want to add a filter, but
for the data adapter.
Miha Markic said:Hi Roby,
You can create whatever select commands (that dataadapter use) you want.
The actual syntax depends on the database used.
--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
"Roby Eisenbraun Martins" <[email protected]>
wrote in message Hi,
I want to fill a dataset with only some records. How can I add a filter
in the dataadapter?
Roby Eisenbraun Martins said:Hi David,
The ideia is to populate the dataset only with the rows that match with
the filter and not filter the values in the dataset.
I was thinking in add parameters in the select command in the data
adapter, but I don't want to create a hole new command, just add the
filter,
and remove in the end.
David W. Rogers said:Hi Roby. Yeah, it's pretty simple to do this, if you want the data
adapter to
get a set of results and you want to filter out some of those. Try
setting
the RowFilter property on the default view for the table before using the
table (or the view) as a datasource. E.g.;
DataView contactInfoView = dtContactInfo.DefaultView;
contactInfoView.Sort = "ContactID, Seq";
contactInfoView.RowFilter = "Parent.ActiveSeq = Seq";
this.dataGrid2.DataSource = contactInfoView;
David
Roby Eisenbraun Martins said:Hi,
I have a data adapter to populate my dataset already. Can I use the
same
one? I don't want to create the query again. I just want to add a
filter, but
for the data adapter.
:
Hi Roby,
You can create whatever select commands (that dataadapter use) you
want.
The actual syntax depends on the database used.
--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
"Roby Eisenbraun Martins"
<[email protected]>
wrote in message
Hi,
I want to fill a dataset with only some records. How can I add a
filter
in the dataadapter?
Miha Markic said:Hi Roby,
How do you crate dataadapter?
Which VS version do you use?
Yes, it is possible to modify dataadapter (more precisly, its
SelectCommand).
--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
Roby Eisenbraun Martins said:Hi David,
The ideia is to populate the dataset only with the rows that match with
the filter and not filter the values in the dataset.
I was thinking in add parameters in the select command in the data
adapter, but I don't want to create a hole new command, just add the
filter,
and remove in the end.
David W. Rogers said:Hi Roby. Yeah, it's pretty simple to do this, if you want the data
adapter to
get a set of results and you want to filter out some of those. Try
setting
the RowFilter property on the default view for the table before using the
table (or the view) as a datasource. E.g.;
DataView contactInfoView = dtContactInfo.DefaultView;
contactInfoView.Sort = "ContactID, Seq";
contactInfoView.RowFilter = "Parent.ActiveSeq = Seq";
this.dataGrid2.DataSource = contactInfoView;
David
:
Hi,
I have a data adapter to populate my dataset already. Can I use the
same
one? I don't want to create the query again. I just want to add a
filter, but
for the data adapter.
:
Hi Roby,
You can create whatever select commands (that dataadapter use) you
want.
The actual syntax depends on the database used.
--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
"Roby Eisenbraun Martins"
<[email protected]>
wrote in message
Hi,
I want to fill a dataset with only some records. How can I add a
filter
in the dataadapter?