PC Review


Reply
Thread Tools Rate Thread

how to see if data changed in DataGrid

 
 
DraguVaso
Guest
Posts: n/a
 
      30th Aug 2004
Hi,

How can I see if the Data is changed by the user in my DataGrid so I can ask
him to save the changes or not?

Thanks,

Pieter


 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      30th Aug 2004
Pieter,

You can check if the underlaying datatable has changes.

Unluckely there is no method datatable.haschanges.

So you should use a workaround something as pseudo

myNewTable as new datatable = datasource.table.getchanges
And than test if that is filled with rows.

I hope that this gives an idea?

Cor


 
Reply With Quote
 
 
 
 
DraguVaso
Guest
Posts: n/a
 
      30th Aug 2004
Hm thanks, that seems to work.
But what if I have 2 bound DataTables in my DataGrid, and I wan't only do
the check on the records that are currently in the DataView?

Pieter

"Cor Ligthert" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Pieter,
>
> You can check if the underlaying datatable has changes.
>
> Unluckely there is no method datatable.haschanges.
>
> So you should use a workaround something as pseudo
>
> myNewTable as new datatable = datasource.table.getchanges
> And than test if that is filled with rows.
>
> I hope that this gives an idea?
>
> Cor
>
>



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      30th Aug 2004
Pieter,

The dataview has as well a table property which tells which table it
references

Cor

> Hm thanks, that seems to work.
> But what if I have 2 bound DataTables in my DataGrid, and I wan't only do
> the check on the records that are currently in the DataView?
>



 
Reply With Quote
 
Miha Markic [MVP C#]
Guest
Posts: n/a
 
      30th Aug 2004
You could also make a loop foreach through all rows and check their RowState
property - it should be even faster than calling GetChanges.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"DraguVaso" <(E-Mail Removed)> wrote in message
news:%23$(E-Mail Removed)...
> Hi,
>
> How can I see if the Data is changed by the user in my DataGrid so I can
> ask
> him to save the changes or not?
>
> Thanks,
>
> Pieter
>
>



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      30th Aug 2004
Miha,

I like to have the datatable.haschanges

And in a chat was told that they where thinking about it. I think it is
easier than making for every table an own dataset what is as well an
alternative.

Do you understand now?

However I do not think that looping or getchanges would make difference.

:-)

Cor


 
Reply With Quote
 
DraguVaso
Guest
Posts: n/a
 
      30th Aug 2004
Thanks,

I gave it a try and it looked at least as fast as the solution of Cor. Maybe
I'm gonna see a difference when I work with bigger DataSets.

Thanks a lot!

Pieter


"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:ea4A%(E-Mail Removed)...
> You could also make a loop foreach through all rows and check their

RowState
> property - it should be even faster than calling GetChanges.
>
> --
> Miha Markic [MVP C#] - RightHand .NET consulting & development
> miha at rthand com
> www.rthand.com
>
> "DraguVaso" <(E-Mail Removed)> wrote in message
> news:%23$(E-Mail Removed)...
> > Hi,
> >
> > How can I see if the Data is changed by the user in my DataGrid so I can
> > ask
> > him to save the changes or not?
> >
> > Thanks,
> >
> > Pieter
> >
> >

>
>



 
Reply With Quote
 
Miha Markic [MVP C#]
Guest
Posts: n/a
 
      30th Aug 2004
Hi Cor,

"Cor Ligthert" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Miha,
>
> I like to have the datatable.haschanges


Yes, me too :-)

>
> And in a chat was told that they where thinking about it. I think it is
> easier than making for every table an own dataset what is as well an
> alternative.
>
> Do you understand now?


Yes, I did understand before, too :-)
>
> However I do not think that looping or getchanges would make difference.


Oh, it does make a difference.
Imagine a table with 10000 rows and all of them are changed.
If you invoke GetChanges you'll get back a nice copy of entire table while
using a loop, there is no overhead of data returned and you can stop at the
first changed row: :-)

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com


 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      30th Aug 2004
Miha,

> Oh, it does make a difference.
> Imagine a table with 10000 rows and all of them are changed.
> If you invoke GetChanges you'll get back a nice copy of entire table while
> using a loop, there is no overhead of data returned and you can stop at

the
> first changed row: :-)


You win this time, I did not think on that, good one.

:-)

Cor


 
Reply With Quote
 
Miha Markic [MVP C#]
Guest
Posts: n/a
 
      30th Aug 2004

> You win this time, I did not think on that, good one.
>
> :-)
>


That makes Slovenia: Netherland 1:0 :-)
Hey Cor, many people, many solutions. Sometimes you win sometimes you don't.
However, it is not about wining, I really like to see many different
solutions - so I can learn.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A way to see when data WITHIN a table has been changed? tjsmags Microsoft Access Getting Started 4 1st Jun 2008 09:58 PM
any event in datagrid raised when data in datagrid changed ali asjad Microsoft Dot NET 1 25th Feb 2005 06:51 PM
how to see if data changed in DataGrid DraguVaso Microsoft VB .NET 11 2nd Sep 2004 08:27 AM
Re: how to see if data changed in DataGrid Cor Ligthert Microsoft VB .NET 0 31st Aug 2004 06:57 AM
Re: How to refresh DataGrid data with dataset data changed?? Stephen Alpert Microsoft Dot NET Framework Forms 0 29th Jul 2003 05:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:37 PM.