Groups | Blog | Home
all groups > dotnet windows forms databinding > august 2006 >

dotnet windows forms databinding : Refreshing the data in a dataview


Enoch Evans
8/28/2006 1:51:48 PM
Hello,

What I'm trying to do is simple, I'm trying to force a dataview to =
refresh its data from a dataset. Here's the overall situation, I have 2 =
tabs on my form, one for inserting new placements and one for modifying =
existing placements. After I add in a new placement on tab 1 I want it =
to show up on the datagrid in tab2. The datagrid is bound to a dataview =
which is in turn bound to a dataset. I've updated the dataset, and =
using the VS debugging tools I've been able to confirm that the dataset =
is updated, but the dataview isn't getting updated. How do I force the =
dataview to update?

Thanks,
Enoch
8/31/2006 2:45:36 PM
The problem is that I'm using the filter and sort options of the =
dataview. The filters are based on the values in various comboboxes so =
I didn't include them as a where clause in the original select statement =
used to fill the dataset. For example:

ds =3D new DataSet("FieldPlacements");

SqlDataAdapter daFieldPlacements_V =3D new SqlDataAdapter("SELECT * FROM =
FieldPlacements_V", connectObj);
daFieldPlacements_V.TableMappings.Add("Table", "FieldPlacements_V");
daFieldPlacements_V.Fill(ds);

DataView studentMPV =3D new DataView(ds.Tables["FieldPlacements_V"]);
studentMPV.RowFilter =3D "CourseID IS NULL";

The various comboboxes will change the rowfilter of studentMPV. Is =
there a way of filtering the dataset table directly?
[quoted text, click to view]
Bind the grid to the data table within the dataset instead. The =
problem will go away.

I'm investigating the fact that this may be a bug.

--=20
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.


=20
[quoted text, click to view]
Hello,

What I'm trying to do is simple, I'm trying to force a dataview to =
refresh its data from a dataset. Here's the overall situation, I have 2 =
tabs on my form, one for inserting new placements and one for modifying =
existing placements. After I add in a new placement on tab 1 I want it =
to show up on the datagrid in tab2. The datagrid is bound to a dataview =
which is in turn bound to a dataset. I've updated the dataset, and =
using the VS debugging tools I've been able to confirm that the dataset =
is updated, but the dataview isn't getting updated. How do I force the =
dataview to update?

Thanks,
Bob Powell [MVP]
8/31/2006 9:10:08 PM
Bind the grid to the data table within the dataset instead. The problem =
will go away.

I'm investigating the fact that this may be a bug.

--=20
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.



[quoted text, click to view]
Hello,

What I'm trying to do is simple, I'm trying to force a dataview to =
refresh its data from a dataset. Here's the overall situation, I have 2 =
tabs on my form, one for inserting new placements and one for modifying =
existing placements. After I add in a new placement on tab 1 I want it =
to show up on the datagrid in tab2. The datagrid is bound to a dataview =
which is in turn bound to a dataset. I've updated the dataset, and =
using the VS debugging tools I've been able to confirm that the dataset =
is updated, but the dataview isn't getting updated. How do I force the =
dataview to update?

Thanks,
AddThis Social Bookmark Button