|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
defaultview is empty, although no filter is setI have a problem with the RowFilter. When I check my datatable in the debugger, I get the following result: table1.Rows.Count 3 table1.DefaultView.RowFilter "" table1.DefaultView.RowStateFilter Unchanged | Added | ModifiedCurrent table1.DefaultView.Count 0 table1.Rows[0].RowState Unchanged table1.Rows[1].RowState Unchanged table1.Rows[2].RowState Unchanged The table has 3 rows, no filters are set for the defaultview, but the defaultview has 0 rows. This occurs after the table was filled by several merge operations. Does anybody know, how I can refresh the defaultview? Thank you for your help. Best regards Isa Isa,
You never can refresh a DataView, because it holds no data. It only shows data from a datatable accooriding the setting of the properties from the DataView. Therefore you probably has set something wrong related to your merge operations, but how can we see that. In your case I would just break it down until you I see the rows. Cor Show quote "Isa" <Virtuell***@gmx.de> schreef in bericht news:1166465186.165367.94360@n67g2000cwd.googlegroups.com... > Hi Newsgroup, > > I have a problem with the RowFilter. > When I check my datatable in the debugger, I get the following result: > > table1.Rows.Count 3 > table1.DefaultView.RowFilter "" > table1.DefaultView.RowStateFilter Unchanged | Added | ModifiedCurrent > table1.DefaultView.Count 0 > table1.Rows[0].RowState Unchanged > table1.Rows[1].RowState Unchanged > table1.Rows[2].RowState Unchanged > > The table has 3 rows, no filters are set for the defaultview, but the > defaultview has 0 rows. > This occurs after the table was filled by several merge operations. > Does anybody know, how I can refresh the defaultview? > > Thank you for your help. > > Best regards > Isa > According to MSDN, "DefaultView is a property that returns
a DataView you can use to sort, filter, and search a DataTable." Maybe you have to apply something to it to get a count. I don't use the DefaultView; if I want a view of the data in a DataTable, I create a new DataView object and go to town. What exactly are you trying to accomplish? Robin S. ------------------------------------------ Show quote "Isa" <Virtuell***@gmx.de> wrote in message news:1166465186.165367.94360@n67g2000cwd.googlegroups.com... > Hi Newsgroup, > > I have a problem with the RowFilter. > When I check my datatable in the debugger, I get the following result: > > table1.Rows.Count 3 > table1.DefaultView.RowFilter "" > table1.DefaultView.RowStateFilter Unchanged | Added | ModifiedCurrent > table1.DefaultView.Count 0 > table1.Rows[0].RowState Unchanged > table1.Rows[1].RowState Unchanged > table1.Rows[2].RowState Unchanged > > The table has 3 rows, no filters are set for the defaultview, but the > defaultview has 0 rows. > This occurs after the table was filled by several merge operations. > Does anybody know, how I can refresh the defaultview? > > Thank you for your help. > > Best regards > Isa > thank you for your responses.
We a using a third party datagrid that uses the defaultview, if you use a datatable as the grid's datasource. I could also use own dataviews instead of datatables, but we would need to change this in many parts of our application. I tried to refresh the defaultview by setting the Rowfilter to "1=1", afterwards the defaultview was o.k. and filtered all 3 rows. But this works only one time after the next resetting and filling the datatable, I would need to change the rowfilter e.g. to "2=2" ("1=1" don't work the second time, I think the defaultview needs any changes in its rowfilter to be refreshed (I know it's only a view, but it seems, that it needs something that triggers the execution of the view)). Before I fill the tables, I execute a table1.reset(), not only a clear, because the datatable has columns, which were added dynamically and must be resetted. Perhaps this cause the problem, but I don't know how to "repair" the defaultview afterwards. Best regards Isa RobinS schrieb: Show quote > According to MSDN, "DefaultView is a property that returns > a DataView you can use to sort, filter, and search a DataTable." > > Maybe you have to apply something to it to get a count. > I don't use the DefaultView; if I want a view of the data in a > DataTable, I create a new DataView object and go to town. > > What exactly are you trying to accomplish? > > Robin S. > ------------------------------------------ > RESET returns the table to its original, uninitialized state.
Hopefully, that's your intent. I don't know how that would cause a problem with the DefaultView; one would think it would also reset the view. Sorry I can't help you more. Robin S. ---------------------------- Show quote "Isa" <Virtuell***@gmx.de> wrote in message news:1166516869.760975.289210@a3g2000cwd.googlegroups.com... > thank you for your responses. > We a using a third party datagrid that uses the defaultview, if you > use > a datatable as the grid's datasource. I could also use own dataviews > instead of datatables, but we would need to change this in many parts > of our application. > I tried to refresh the defaultview by setting the Rowfilter to "1=1", > afterwards the defaultview was o.k. and filtered all 3 rows. But this > works only one time after the next resetting and filling the > datatable, > I would need to change the rowfilter e.g. to "2=2" ("1=1" don't work > the second time, I think the defaultview needs any changes in its > rowfilter to be refreshed (I know it's only a view, but it seems, that > it needs something that triggers the execution of the view)). > Before I fill the tables, I execute a table1.reset(), not only a > clear, > because the datatable has columns, which were added dynamically and > must be resetted. Perhaps this cause the problem, but I don't know how > to "repair" the defaultview afterwards. > > Best regards > Isa > > > RobinS schrieb: > >> According to MSDN, "DefaultView is a property that returns >> a DataView you can use to sort, filter, and search a DataTable." >> >> Maybe you have to apply something to it to get a count. >> I don't use the DefaultView; if I want a view of the data in a >> DataTable, I create a new DataView object and go to town. >> >> What exactly are you trying to accomplish? >> >> Robin S. >> ------------------------------------------ >> > Isa,
A filter is a column and a variable. Do I have to assume that you have named your columns 1, 2 and 3. A little bit confusing don't you think so? Cor Show quote "Isa" <Virtuell***@gmx.de> schreef in bericht news:1166516869.760975.289210@a3g2000cwd.googlegroups.com... > thank you for your responses. > We a using a third party datagrid that uses the defaultview, if you use > a datatable as the grid's datasource. I could also use own dataviews > instead of datatables, but we would need to change this in many parts > of our application. > I tried to refresh the defaultview by setting the Rowfilter to "1=1", > afterwards the defaultview was o.k. and filtered all 3 rows. But this > works only one time after the next resetting and filling the datatable, > I would need to change the rowfilter e.g. to "2=2" ("1=1" don't work > the second time, I think the defaultview needs any changes in its > rowfilter to be refreshed (I know it's only a view, but it seems, that > it needs something that triggers the execution of the view)). > Before I fill the tables, I execute a table1.reset(), not only a clear, > because the datatable has columns, which were added dynamically and > must be resetted. Perhaps this cause the problem, but I don't know how > to "repair" the defaultview afterwards. > > Best regards > Isa > > > RobinS schrieb: > >> According to MSDN, "DefaultView is a property that returns >> a DataView you can use to sort, filter, and search a DataTable." >> >> Maybe you have to apply something to it to get a count. >> I don't use the DefaultView; if I want a view of the data in a >> DataTable, I create a new DataView object and go to town. >> >> What exactly are you trying to accomplish? >> >> Robin S. >> ------------------------------------------ >> > I think the problem is caused by the reset function. All other
defaultviews are not affected. I have changed the code, so that I don't need the reset function; instead of this I create a new instance of the datatable. Thanks to all for your help! Isa Cor: > A little bit confusing don't you think so? yes I think so :-) Why do you think I have named my columns 1,2,3 ?Hi,
"Isa" <Virtuell***@gmx.de> wrote in message I haven't had a chance to look into the problem, but i remembered there was news:1166552017.742790.243980@i12g2000cwa.googlegroups.com... >I think the problem is caused by the reset function. All other > defaultviews are not affected. > I have changed the code, so that I don't need the reset function; > instead of this I create a new instance of the datatable. a similar question and answer on csharp not lang ago, http://groups.google.be/group/microsoft.public.dotnet.languages.csharp/browse_frm/thread/3e20db03f174795c/c51d720ed7bf0937?lnk=st&q=%2Bdatatable+%2Breset&rnum=4&hl=nl#c51d720ed7bf0937 Maybe this can help you ... Greetings Show quote > > Thanks to all for your help! > Isa > > Cor: >> A little bit confusing don't you think so? > yes I think so :-) Why do you think I have named my columns 1,2,3 ? > Robin,
Why not the defaultview, it is the most near the original table. Cor Show quote "RobinS" <RobinS@NoSpam.yah.none> schreef in bericht news:DY2dnYg-FPrjCRrYnZ2dnUVZ_oCmnZ2d@comcast.com... > According to MSDN, "DefaultView is a property that returns > a DataView you can use to sort, filter, and search a DataTable." > > Maybe you have to apply something to it to get a count. > I don't use the DefaultView; if I want a view of the data in a > DataTable, I create a new DataView object and go to town. > > What exactly are you trying to accomplish? > > Robin S. > ------------------------------------------ > > "Isa" <Virtuell***@gmx.de> wrote in message > news:1166465186.165367.94360@n67g2000cwd.googlegroups.com... >> Hi Newsgroup, >> >> I have a problem with the RowFilter. >> When I check my datatable in the debugger, I get the following result: >> >> table1.Rows.Count 3 >> table1.DefaultView.RowFilter "" >> table1.DefaultView.RowStateFilter Unchanged | Added | ModifiedCurrent >> table1.DefaultView.Count 0 >> table1.Rows[0].RowState Unchanged >> table1.Rows[1].RowState Unchanged >> table1.Rows[2].RowState Unchanged >> >> The table has 3 rows, no filters are set for the defaultview, but the >> defaultview has 0 rows. >> This occurs after the table was filled by several merge operations. >> Does anybody know, how I can refresh the defaultview? >> >> Thank you for your help. >> >> Best regards >> Isa >> > > The ADO book I read didn't really talk about the DefaultView.
When it talked about DataViews, the examples always displayed creating your own, so that's what I do. I guess you do what you know. Robin S. ---------------------- Show quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:edE9JX5IHHA.5104@TK2MSFTNGP06.phx.gbl... > Robin, > > Why not the defaultview, it is the most near the original table. > > Cor > > "RobinS" <RobinS@NoSpam.yah.none> schreef in bericht > news:DY2dnYg-FPrjCRrYnZ2dnUVZ_oCmnZ2d@comcast.com... >> According to MSDN, "DefaultView is a property that returns >> a DataView you can use to sort, filter, and search a DataTable." >> >> Maybe you have to apply something to it to get a count. >> I don't use the DefaultView; if I want a view of the data in a >> DataTable, I create a new DataView object and go to town. >> >> What exactly are you trying to accomplish? >> >> Robin S. >> ------------------------------------------ >> >> "Isa" <Virtuell***@gmx.de> wrote in message >> news:1166465186.165367.94360@n67g2000cwd.googlegroups.com... >>> Hi Newsgroup, >>> >>> I have a problem with the RowFilter. >>> When I check my datatable in the debugger, I get the following >>> result: >>> >>> table1.Rows.Count 3 >>> table1.DefaultView.RowFilter "" >>> table1.DefaultView.RowStateFilter Unchanged | Added | >>> ModifiedCurrent >>> table1.DefaultView.Count 0 >>> table1.Rows[0].RowState Unchanged >>> table1.Rows[1].RowState Unchanged >>> table1.Rows[2].RowState Unchanged >>> >>> The table has 3 rows, no filters are set for the defaultview, but >>> the >>> defaultview has 0 rows. >>> This occurs after the table was filled by several merge operations. >>> Does anybody know, how I can refresh the defaultview? >>> >>> Thank you for your help. >>> >>> Best regards >>> Isa >>> >> >> > > |
|||||||||||||||||||||||