473,405 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

filtering a datagrid

Art
Hi,

Once again, I'm stuck.

I want to view a table using a DataGrid. I'd like to fiter that view by
criteria on various fields.

So far, I've created a DataAdapter, generated a DataSet and used that
DataSet as the DataSource for a DataGrid. I put a "fill" in my open form
event.
Me.OleDbDataAdapter1.Fill(DataSet11)

Then I tried a select statement:
Me.DataSet11.Company.Select("ID=3", "ID", DataViewRowState.CurrentRows)

"Company" is the one and only table I selected when configuring the
DataAdapter.

The entire dataset shows up in my DataGrid. I can't seem to get it to filter.

Can anyone help?

Art
Nov 21 '05 #1
4 1191
Try using a dataview to filter the events. Then bind the dataview to the
datasource. Set the DataView.Rowfilter property to get your subset.

Chris

"Art" <Ar*@discussions.microsoft.com> wrote in message
news:9B**********************************@microsof t.com...
Hi,

Once again, I'm stuck.

I want to view a table using a DataGrid. I'd like to fiter that view by
criteria on various fields.

So far, I've created a DataAdapter, generated a DataSet and used that
DataSet as the DataSource for a DataGrid. I put a "fill" in my open form
event.
Me.OleDbDataAdapter1.Fill(DataSet11)

Then I tried a select statement:
Me.DataSet11.Company.Select("ID=3", "ID", DataViewRowState.CurrentRows)

"Company" is the one and only table I selected when configuring the
DataAdapter.

The entire dataset shows up in my DataGrid. I can't seem to get it to
filter.

Can anyone help?

Art

Nov 21 '05 #2
Art
Chris,

I will need to select criteria during run time. That is, I'll pick
something from a ComboBox and I'll want to make my DataGrid show me the
appropriate records. Can a DataView do this? I did read a little on it and
it sounded like it was something that had to be set up ahead of time.

Thanks for your help.

Art

"Chris, Master of All Things Insignifican" wrote:
Try using a dataview to filter the events. Then bind the dataview to the
datasource. Set the DataView.Rowfilter property to get your subset.

Chris

"Art" <Ar*@discussions.microsoft.com> wrote in message
news:9B**********************************@microsof t.com...
Hi,

Once again, I'm stuck.

I want to view a table using a DataGrid. I'd like to fiter that view by
criteria on various fields.

So far, I've created a DataAdapter, generated a DataSet and used that
DataSet as the DataSource for a DataGrid. I put a "fill" in my open form
event.
Me.OleDbDataAdapter1.Fill(DataSet11)

Then I tried a select statement:
Me.DataSet11.Company.Select("ID=3", "ID", DataViewRowState.CurrentRows)

"Company" is the one and only table I selected when configuring the
DataAdapter.

The entire dataset shows up in my DataGrid. I can't seem to get it to
filter.

Can anyone help?

Art


Nov 21 '05 #3
nope. it's all runtime. This is an example that I wrote in here but didn't
test but the idea will be there

Me.OleDbDataAdapter1.Fill(DataSet11)
DataSet11.Table(0).DefaultView.RowFilter = "ColumnName = FilterValue"
DataGrid1.DataSource = DataSet11.Table(0).DefaultView

That should work. The RowFilter property is basically a where clause of a
SQL statment. You can create a DataView object instead of using the
defaultview from the datatable if you want.

Me.OleDbDataAdapter1.Fill(DataSet11)
Dim DV as DataView
DV = DataSet11.Table(0).DefaultView
DV.RowFilter = .RowFilter = "ColumnName = FilterValue"
DataGrid1.DataSource = DV

Hope it helps
Chris

"Art" <Ar*@discussions.microsoft.com> wrote in message
news:37**********************************@microsof t.com...
Chris,

I will need to select criteria during run time. That is, I'll pick
something from a ComboBox and I'll want to make my DataGrid show me the
appropriate records. Can a DataView do this? I did read a little on it
and
it sounded like it was something that had to be set up ahead of time.

Thanks for your help.

Art

"Chris, Master of All Things Insignifican" wrote:
Try using a dataview to filter the events. Then bind the dataview to the
datasource. Set the DataView.Rowfilter property to get your subset.

Chris

"Art" <Ar*@discussions.microsoft.com> wrote in message
news:9B**********************************@microsof t.com...
> Hi,
>
> Once again, I'm stuck.
>
> I want to view a table using a DataGrid. I'd like to fiter that view
> by
> criteria on various fields.
>
> So far, I've created a DataAdapter, generated a DataSet and used that
> DataSet as the DataSource for a DataGrid. I put a "fill" in my open
> form
> event.
> Me.OleDbDataAdapter1.Fill(DataSet11)
>
> Then I tried a select statement:
> Me.DataSet11.Company.Select("ID=3", "ID",
> DataViewRowState.CurrentRows)
>
> "Company" is the one and only table I selected when configuring the
> DataAdapter.
>
> The entire dataset shows up in my DataGrid. I can't seem to get it to
> filter.
>
> Can anyone help?
>
> Art


Nov 21 '05 #4
Art
Chris,

Works GREAT!! Thanks!

Art

"Chris, Master of All Things Insignifican" wrote:
nope. it's all runtime. This is an example that I wrote in here but didn't
test but the idea will be there

Me.OleDbDataAdapter1.Fill(DataSet11)
DataSet11.Table(0).DefaultView.RowFilter = "ColumnName = FilterValue"
DataGrid1.DataSource = DataSet11.Table(0).DefaultView

That should work. The RowFilter property is basically a where clause of a
SQL statment. You can create a DataView object instead of using the
defaultview from the datatable if you want.

Me.OleDbDataAdapter1.Fill(DataSet11)
Dim DV as DataView
DV = DataSet11.Table(0).DefaultView
DV.RowFilter = .RowFilter = "ColumnName = FilterValue"
DataGrid1.DataSource = DV

Hope it helps
Chris

"Art" <Ar*@discussions.microsoft.com> wrote in message
news:37**********************************@microsof t.com...
Chris,

I will need to select criteria during run time. That is, I'll pick
something from a ComboBox and I'll want to make my DataGrid show me the
appropriate records. Can a DataView do this? I did read a little on it
and
it sounded like it was something that had to be set up ahead of time.

Thanks for your help.

Art

"Chris, Master of All Things Insignifican" wrote:
Try using a dataview to filter the events. Then bind the dataview to the
datasource. Set the DataView.Rowfilter property to get your subset.

Chris

"Art" <Ar*@discussions.microsoft.com> wrote in message
news:9B**********************************@microsof t.com...
> Hi,
>
> Once again, I'm stuck.
>
> I want to view a table using a DataGrid. I'd like to fiter that view
> by
> criteria on various fields.
>
> So far, I've created a DataAdapter, generated a DataSet and used that
> DataSet as the DataSource for a DataGrid. I put a "fill" in my open
> form
> event.
> Me.OleDbDataAdapter1.Fill(DataSet11)
>
> Then I tried a select statement:
> Me.DataSet11.Company.Select("ID=3", "ID",
> DataViewRowState.CurrentRows)
>
> "Company" is the one and only table I selected when configuring the
> DataAdapter.
>
> The entire dataset shows up in my DataGrid. I can't seem to get it to
> filter.
>
> Can anyone help?
>
> Art


Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a...
10
by: milk-jam | last post by:
I'm trying to set my datagridview so that the first row will be left blank and to use it as a filtering filed for the datagridview. Until now I was using 2 datagridview the upper one with a header...
2
by: Gummy | last post by:
Hello All, I have a webpage that has two dropdown listboxes. Based on what is selected in these dropdown listboxes, it filters a DataGrid . That works fine. In the DataGrid , when I go to edit...
5
by: LDD | last post by:
Hi Folks I'm trying to determine a way to handle paging, filtering and sorting in a datagrid. If I choose to filter and sort, I'd like to return a subset. If that resultset has more records...
2
by: jvdub22 | last post by:
I have a vb.net windows form application that has two datagrids on it that have a master - detail relationship. The underlying database is an sql database. The application works fine when I first...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.