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

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
I have seen this--when I call Read before HasRows or bind the rowset to a
complex bound control.

--
____________________________________
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)
 
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.
 
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
 
Back
Top