PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
refreshing datasets
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
refreshing datasets
![]() |
refreshing datasets |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi,
I am using VS.NET 2005 with SQL Server 2000. I have a Dataset that contains a DataTable that is populated using DataSet.Fill(). I need to periodically refresh this data. If I just do .Fill() again, I end up with issues of the DataGrid losing it's current position etc. Can I utilize a timestamp column in the table and then somehow use DataSet.GetChanges() and DataSet.Merge()? This way only modified data will be downloaded from the server minimizing traffic and hopefully the DataGrid will remember it's position. -- Best regards Mark |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Hi,
Why don't you store your current position (current PK) before doing refresh and after refresh re-set position? -- Miha Markic [MVP C#, INETA Country Leader for Slovenia] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ "Mark" <swozz_@hotmail.com> wrote in message news:Oxq25JulGHA.1240@TK2MSFTNGP05.phx.gbl... > Hi, > > I am using VS.NET 2005 with SQL Server 2000. > > I have a Dataset that contains a DataTable that is populated using > DataSet.Fill(). I need to periodically refresh this data. > > If I just do .Fill() again, I end up with issues of the DataGrid losing > it's current position etc. > > Can I utilize a timestamp column in the table and then somehow use > DataSet.GetChanges() and DataSet.Merge()? This way only modified data will > be downloaded from the server minimizing traffic and hopefully the > DataGrid will remember it's position. > > -- > Best regards > Mark > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Refresh what - the datagrid or dataset? Refreshing the datagrid is no good -
it doesn't get new data from the database, refreshing the dataset can be done by refilling it but then like I say the datagrid loses it's position -- Best regards Mark "Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:O7RbHWvlGHA.4220@TK2MSFTNGP05.phx.gbl... > Hi, > > Why don't you store your current position (current PK) before doing > refresh and after refresh re-set position? > > -- > Miha Markic [MVP C#, INETA Country Leader for Slovenia] > RightHand .NET consulting & development www.rthand.com > Blog: http://cs.rthand.com/blogs/blog_with_righthand/ > > "Mark" <swozz_@hotmail.com> wrote in message > news:Oxq25JulGHA.1240@TK2MSFTNGP05.phx.gbl... >> Hi, >> >> I am using VS.NET 2005 with SQL Server 2000. >> >> I have a Dataset that contains a DataTable that is populated using >> DataSet.Fill(). I need to periodically refresh this data. >> >> If I just do .Fill() again, I end up with issues of the DataGrid losing >> it's current position etc. >> >> Can I utilize a timestamp column in the table and then somehow use >> DataSet.GetChanges() and DataSet.Merge()? This way only modified data >> will be downloaded from the server minimizing traffic and hopefully the >> DataGrid will remember it's position. >> >> -- >> Best regards >> Mark >> > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
That's why you have to store the position in grid *before* refill and
re-apply it after refill. -- Miha Markic [MVP C#, INETA Country Leader for Slovenia] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ "Mark" <swozz_@hotmail.com> wrote in message news:egYYnXwlGHA.3576@TK2MSFTNGP04.phx.gbl... > Refresh what - the datagrid or dataset? Refreshing the datagrid is no > good - it doesn't get new data from the database, refreshing the dataset > can be done by refilling it but then like I say the datagrid loses it's > position > > -- > Best regards > Mark > > "Miha Markic [MVP C#]" <miha at rthand com> wrote in message > news:O7RbHWvlGHA.4220@TK2MSFTNGP05.phx.gbl... >> Hi, >> >> Why don't you store your current position (current PK) before doing >> refresh and after refresh re-set position? >> >> -- >> Miha Markic [MVP C#, INETA Country Leader for Slovenia] >> RightHand .NET consulting & development www.rthand.com >> Blog: http://cs.rthand.com/blogs/blog_with_righthand/ >> >> "Mark" <swozz_@hotmail.com> wrote in message >> news:Oxq25JulGHA.1240@TK2MSFTNGP05.phx.gbl... >>> Hi, >>> >>> I am using VS.NET 2005 with SQL Server 2000. >>> >>> I have a Dataset that contains a DataTable that is populated using >>> DataSet.Fill(). I need to periodically refresh this data. >>> >>> If I just do .Fill() again, I end up with issues of the DataGrid losing >>> it's current position etc. >>> >>> Can I utilize a timestamp column in the table and then somehow use >>> DataSet.GetChanges() and DataSet.Merge()? This way only modified data >>> will be downloaded from the server minimizing traffic and hopefully the >>> DataGrid will remember it's position. >>> >>> -- >>> Best regards >>> Mark >>> >> >> > > |
|
|
|
#5 |
|
Guest
Posts: n/a
|
Mark,
Did you clear the dataset before refilling it again? dataset.clear Cor "Mark" <swozz_@hotmail.com> schreef in bericht news:Oxq25JulGHA.1240@TK2MSFTNGP05.phx.gbl... > Hi, > > I am using VS.NET 2005 with SQL Server 2000. > > I have a Dataset that contains a DataTable that is populated using > DataSet.Fill(). I need to periodically refresh this data. > > If I just do .Fill() again, I end up with issues of the DataGrid losing > it's current position etc. > > Can I utilize a timestamp column in the table and then somehow use > DataSet.GetChanges() and DataSet.Merge()? This way only modified data will > be downloaded from the server minimizing traffic and hopefully the > DataGrid will remember it's position. > > -- > Best regards > Mark > |
|
|
|
#6 |
|
Guest
Posts: n/a
|
How do I do that? I can save and restore the currency managers Position
property but this is no good since the position of the currently highlighted row can change once new data has been brought into the dataset so doing this doesn't always rehighlight the same row. -- Best regards Mark "Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:%23YnYZiwlGHA.1740@TK2MSFTNGP05.phx.gbl... > That's why you have to store the position in grid *before* refill and > re-apply it after refill. > > -- > Miha Markic [MVP C#, INETA Country Leader for Slovenia] > RightHand .NET consulting & development www.rthand.com > Blog: http://cs.rthand.com/blogs/blog_with_righthand/ > > "Mark" <swozz_@hotmail.com> wrote in message > news:egYYnXwlGHA.3576@TK2MSFTNGP04.phx.gbl... >> Refresh what - the datagrid or dataset? Refreshing the datagrid is no >> good - it doesn't get new data from the database, refreshing the dataset >> can be done by refilling it but then like I say the datagrid loses it's >> position >> >> -- >> Best regards >> Mark >> >> "Miha Markic [MVP C#]" <miha at rthand com> wrote in message >> news:O7RbHWvlGHA.4220@TK2MSFTNGP05.phx.gbl... >>> Hi, >>> >>> Why don't you store your current position (current PK) before doing >>> refresh and after refresh re-set position? >>> >>> -- >>> Miha Markic [MVP C#, INETA Country Leader for Slovenia] >>> RightHand .NET consulting & development www.rthand.com >>> Blog: http://cs.rthand.com/blogs/blog_with_righthand/ >>> >>> "Mark" <swozz_@hotmail.com> wrote in message >>> news:Oxq25JulGHA.1240@TK2MSFTNGP05.phx.gbl... >>>> Hi, >>>> >>>> I am using VS.NET 2005 with SQL Server 2000. >>>> >>>> I have a Dataset that contains a DataTable that is populated using >>>> DataSet.Fill(). I need to periodically refresh this data. >>>> >>>> If I just do .Fill() again, I end up with issues of the DataGrid losing >>>> it's current position etc. >>>> >>>> Can I utilize a timestamp column in the table and then somehow use >>>> DataSet.GetChanges() and DataSet.Merge()? This way only modified data >>>> will be downloaded from the server minimizing traffic and hopefully the >>>> DataGrid will remember it's position. >>>> >>>> -- >>>> Best regards >>>> Mark >>>> >>> >>> >> >> > > |
|
|
|
#7 |
|
Guest
Posts: n/a
|
Hi Mark,
You have to extract the PK value out of currently positioned record: CurrencyManager.Current will give you the source object. Once you refilled the dataset you have to figure out the position of record with previously retrieved PK value, perhaps by using combination of DataTable.Rows.Find and DataTable.Rows.IndexOf methods. HTH -- Miha Markic [MVP C#, INETA Country Leader for Slovenia] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ "Mark" <swozz_@hotmail.com> wrote in message news:OjZMpB3lGHA.4268@TK2MSFTNGP05.phx.gbl... > How do I do that? I can save and restore the currency managers Position > property but this is no good since the position of the currently > highlighted row can change once new data has been brought into the dataset > so doing this doesn't always rehighlight the same row. > > -- > Best regards > Mark > > "Miha Markic [MVP C#]" <miha at rthand com> wrote in message > news:%23YnYZiwlGHA.1740@TK2MSFTNGP05.phx.gbl... >> That's why you have to store the position in grid *before* refill and >> re-apply it after refill. >> >> -- >> Miha Markic [MVP C#, INETA Country Leader for Slovenia] >> RightHand .NET consulting & development www.rthand.com >> Blog: http://cs.rthand.com/blogs/blog_with_righthand/ >> >> "Mark" <swozz_@hotmail.com> wrote in message >> news:egYYnXwlGHA.3576@TK2MSFTNGP04.phx.gbl... >>> Refresh what - the datagrid or dataset? Refreshing the datagrid is no >>> good - it doesn't get new data from the database, refreshing the dataset >>> can be done by refilling it but then like I say the datagrid loses it's >>> position >>> >>> -- >>> Best regards >>> Mark >>> >>> "Miha Markic [MVP C#]" <miha at rthand com> wrote in message >>> news:O7RbHWvlGHA.4220@TK2MSFTNGP05.phx.gbl... >>>> Hi, >>>> >>>> Why don't you store your current position (current PK) before doing >>>> refresh and after refresh re-set position? >>>> >>>> -- >>>> Miha Markic [MVP C#, INETA Country Leader for Slovenia] >>>> RightHand .NET consulting & development www.rthand.com >>>> Blog: http://cs.rthand.com/blogs/blog_with_righthand/ >>>> >>>> "Mark" <swozz_@hotmail.com> wrote in message >>>> news:Oxq25JulGHA.1240@TK2MSFTNGP05.phx.gbl... >>>>> Hi, >>>>> >>>>> I am using VS.NET 2005 with SQL Server 2000. >>>>> >>>>> I have a Dataset that contains a DataTable that is populated using >>>>> DataSet.Fill(). I need to periodically refresh this data. >>>>> >>>>> If I just do .Fill() again, I end up with issues of the DataGrid >>>>> losing it's current position etc. >>>>> >>>>> Can I utilize a timestamp column in the table and then somehow use >>>>> DataSet.GetChanges() and DataSet.Merge()? This way only modified data >>>>> will be downloaded from the server minimizing traffic and hopefully >>>>> the DataGrid will remember it's position. >>>>> >>>>> -- >>>>> Best regards >>>>> Mark >>>>> >>>> >>>> >>> >>> >> >> > > |
|
|
|
#8 |
|
Guest
Posts: n/a
|
Miha,
Thanks -- Best regards Mark "Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:u1u7oc3lGHA.4808@TK2MSFTNGP05.phx.gbl... > Hi Mark, > > You have to extract the PK value out of currently positioned record: > CurrencyManager.Current will give you the source object. > Once you refilled the dataset you have to figure out the position of > record with previously retrieved PK value, perhaps by using combination of > DataTable.Rows.Find and DataTable.Rows.IndexOf methods. > > HTH > -- > Miha Markic [MVP C#, INETA Country Leader for Slovenia] > RightHand .NET consulting & development www.rthand.com > Blog: http://cs.rthand.com/blogs/blog_with_righthand/ > > "Mark" <swozz_@hotmail.com> wrote in message > news:OjZMpB3lGHA.4268@TK2MSFTNGP05.phx.gbl... >> How do I do that? I can save and restore the currency managers Position >> property but this is no good since the position of the currently >> highlighted row can change once new data has been brought into the >> dataset so doing this doesn't always rehighlight the same row. >> >> -- >> Best regards >> Mark >> >> "Miha Markic [MVP C#]" <miha at rthand com> wrote in message >> news:%23YnYZiwlGHA.1740@TK2MSFTNGP05.phx.gbl... >>> That's why you have to store the position in grid *before* refill and >>> re-apply it after refill. >>> >>> -- >>> Miha Markic [MVP C#, INETA Country Leader for Slovenia] >>> RightHand .NET consulting & development www.rthand.com >>> Blog: http://cs.rthand.com/blogs/blog_with_righthand/ >>> >>> "Mark" <swozz_@hotmail.com> wrote in message >>> news:egYYnXwlGHA.3576@TK2MSFTNGP04.phx.gbl... >>>> Refresh what - the datagrid or dataset? Refreshing the datagrid is no >>>> good - it doesn't get new data from the database, refreshing the >>>> dataset can be done by refilling it but then like I say the datagrid >>>> loses it's position >>>> >>>> -- >>>> Best regards >>>> Mark >>>> >>>> "Miha Markic [MVP C#]" <miha at rthand com> wrote in message >>>> news:O7RbHWvlGHA.4220@TK2MSFTNGP05.phx.gbl... >>>>> Hi, >>>>> >>>>> Why don't you store your current position (current PK) before doing >>>>> refresh and after refresh re-set position? >>>>> >>>>> -- >>>>> Miha Markic [MVP C#, INETA Country Leader for Slovenia] >>>>> RightHand .NET consulting & development www.rthand.com >>>>> Blog: http://cs.rthand.com/blogs/blog_with_righthand/ >>>>> >>>>> "Mark" <swozz_@hotmail.com> wrote in message >>>>> news:Oxq25JulGHA.1240@TK2MSFTNGP05.phx.gbl... >>>>>> Hi, >>>>>> >>>>>> I am using VS.NET 2005 with SQL Server 2000. >>>>>> >>>>>> I have a Dataset that contains a DataTable that is populated using >>>>>> DataSet.Fill(). I need to periodically refresh this data. >>>>>> >>>>>> If I just do .Fill() again, I end up with issues of the DataGrid >>>>>> losing it's current position etc. >>>>>> >>>>>> Can I utilize a timestamp column in the table and then somehow use >>>>>> DataSet.GetChanges() and DataSet.Merge()? This way only modified data >>>>>> will be downloaded from the server minimizing traffic and hopefully >>>>>> the DataGrid will remember it's position. >>>>>> >>>>>> -- >>>>>> Best regards >>>>>> Mark >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > |
|
|
|
#9 |
|
Guest
Posts: n/a
|
Using IndexOf kind of works, but it gives you the position of the row in the
DataTable - if the DataGridView is sorted, then this position is meaningless - is there a way around this? -- Best regards Mark Baldwin "Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:u1u7oc3lGHA.4808@TK2MSFTNGP05.phx.gbl... > Hi Mark, > > You have to extract the PK value out of currently positioned record: > CurrencyManager.Current will give you the source object. > Once you refilled the dataset you have to figure out the position of > record with previously retrieved PK value, perhaps by using combination of > DataTable.Rows.Find and DataTable.Rows.IndexOf methods. > > HTH > -- > Miha Markic [MVP C#, INETA Country Leader for Slovenia] > RightHand .NET consulting & development www.rthand.com > Blog: http://cs.rthand.com/blogs/blog_with_righthand/ > > "Mark" <swozz_@hotmail.com> wrote in message > news:OjZMpB3lGHA.4268@TK2MSFTNGP05.phx.gbl... >> How do I do that? I can save and restore the currency managers Position >> property but this is no good since the position of the currently >> highlighted row can change once new data has been brought into the >> dataset so doing this doesn't always rehighlight the same row. >> >> -- >> Best regards >> Mark >> >> "Miha Markic [MVP C#]" <miha at rthand com> wrote in message >> news:%23YnYZiwlGHA.1740@TK2MSFTNGP05.phx.gbl... >>> That's why you have to store the position in grid *before* refill and >>> re-apply it after refill. >>> >>> -- >>> Miha Markic [MVP C#, INETA Country Leader for Slovenia] >>> RightHand .NET consulting & development www.rthand.com >>> Blog: http://cs.rthand.com/blogs/blog_with_righthand/ >>> >>> "Mark" <swozz_@hotmail.com> wrote in message >>> news:egYYnXwlGHA.3576@TK2MSFTNGP04.phx.gbl... >>>> Refresh what - the datagrid or dataset? Refreshing the datagrid is no >>>> good - it doesn't get new data from the database, refreshing the >>>> dataset can be done by refilling it but then like I say the datagrid >>>> loses it's position >>>> >>>> -- >>>> Best regards >>>> Mark >>>> >>>> "Miha Markic [MVP C#]" <miha at rthand com> wrote in message >>>> news:O7RbHWvlGHA.4220@TK2MSFTNGP05.phx.gbl... >>>>> Hi, >>>>> >>>>> Why don't you store your current position (current PK) before doing >>>>> refresh and after refresh re-set position? >>>>> >>>>> -- >>>>> Miha Markic [MVP C#, INETA Country Leader for Slovenia] >>>>> RightHand .NET consulting & development www.rthand.com >>>>> Blog: http://cs.rthand.com/blogs/blog_with_righthand/ >>>>> >>>>> "Mark" <swozz_@hotmail.com> wrote in message >>>>> news:Oxq25JulGHA.1240@TK2MSFTNGP05.phx.gbl... >>>>>> Hi, >>>>>> >>>>>> I am using VS.NET 2005 with SQL Server 2000. >>>>>> >>>>>> I have a Dataset that contains a DataTable that is populated using >>>>>> DataSet.Fill(). I need to periodically refresh this data. >>>>>> >>>>>> If I just do .Fill() again, I end up with issues of the DataGrid >>>>>> losing it's current position etc. >>>>>> >>>>>> Can I utilize a timestamp column in the table and then somehow use >>>>>> DataSet.GetChanges() and DataSet.Merge()? This way only modified data >>>>>> will be downloaded from the server minimizing traffic and hopefully >>>>>> the DataGrid will remember it's position. >>>>>> >>>>>> -- >>>>>> Best regards >>>>>> Mark >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

