Home All Groups Group Topic Archive Search About
Author
23 Jun 2006 1:30 PM
Mark
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

Author
23 Jun 2006 6:47 PM
Miha Markic [MVP C#]
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/

Show quote
"Mark" <swo***@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
>
Author
23 Jun 2006 8:45 PM
Mark
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

Show quote
"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" <swo***@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
>>
>
>
Author
23 Jun 2006 9:04 PM
Miha Markic [MVP C#]
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/

Show quote
"Mark" <swo***@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" <swo***@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
>>>
>>
>>
>
>
Author
24 Jun 2006 9:27 AM
Mark
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

Show quote
"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" <swo***@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" <swo***@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
>>>>
>>>
>>>
>>
>>
>
>
Author
24 Jun 2006 10:05 AM
Miha Markic [MVP C#]
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/

Show quote
"Mark" <swo***@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" <swo***@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" <swo***@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
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Author
24 Jun 2006 10:42 AM
Mark
Miha,

Thanks

--
Best regards
Mark

Show quote
"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" <swo***@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" <swo***@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" <swo***@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
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Author
28 Jun 2006 8:38 AM
Mark
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

Show quote
"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" <swo***@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" <swo***@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" <swo***@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
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Author
24 Jun 2006 5:29 AM
Cor Ligthert [MVP]
Mark,

Did you clear the dataset before refilling it again?

dataset.clear

Cor

Show quote
"Mark" <swo***@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
>

AddThis Social Bookmark Button