Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / August 2007

Tip: Looking for answers? Try searching our database.

HasChanges returns false for one row, true when more than one

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike G Burton - 27 Aug 2007 21:40 GMT
I have a (third-party) grid bound to a dataset for display purposes, but
during the operation in question I'm directly updating the dataset from my
application code.  When I call HasChanges on the dataset, I get False if the
dataset has a single row, but True if the dataset has multiple rows.  Has
anyone seen this behaviour, and is there a workaround?

Thanks,
mgb
William (Bill) Vaughn - 27 Aug 2007 21:56 GMT
I have seen this--when I call Read before HasRows or bind the rowset to a
complex bound control.

Signature

____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

>I have a (third-party) grid bound to a dataset for display purposes, but
> during the operation in question I'm directly updating the dataset from my
[quoted text clipped - 5 lines]
> Thanks,
> mgb
Jim Rand - 27 Aug 2007 22:04 GMT
Details, details, .....

private void timer_Tick(object sender, EventArgs e)
{
 if (dsNonMembers.HasChanges())
 {
   SetButtons(true);
 }
 else
 {
   if (bsNonMembers.Count > 0)
   {
     if
(((DataRowView)bsNonMembers.Current).Row.HasVersion(DataRowVersion.Proposed))
     {
       SetButtons(true);
     }
   }
 }
}

EndEdit writes the changes to the dataset.  With one row, you have to peek.
If a Proposed is found, call EndEdit on the underlying binding source and
the write your changes back to the database.

>I have a (third-party) grid bound to a dataset for display purposes, but
> during the operation in question I'm directly updating the dataset from my
[quoted text clipped - 5 lines]
> Thanks,
> mgb
Mike G Burton - 28 Aug 2007 16:20 GMT
EndEdit() (called on the table) worked like a charm; I needed to GetChanges()
so checking for proposed changes unfortunately wasn't sufficient.  EndEdit
doesn't seem to cause any issues regardless of row state, so I'm content with
just calling it directly within the operation for now.

Much appreciated!
MGB

> Details, details, .....
>
[quoted text clipped - 30 lines]
> > Thanks,
> > mgb

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.