Inline, please...
Best regards,
Ilya
This posting is provided "AS IS" with no warranties, and confers no rights.<
[email protected]>
Subject: Re: DataTable.HasChanges?
Date: Fri, 7 May 2004 16:53:41 -0400
Lines: 115
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Message-ID: <
[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: 65.23.106.65
Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11
phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:52657
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
Ilya:
Quick question b/c I've heard two different things. Does the adapter loop
through the table no matter what checking the rowstate when you call
update?
DataAdapter internals are quite complicated, but the simple answer would be
"yes".
Someone had told me the HasChanges property is set and it this is set, it
circumvents iterating the dataset.
This seems to be a smart idea...
Too bad, HasChanges() is not just a bit value to return.
It actually loops through all the records to determine if you have changes
in the DataSet.
Thus, HasChanges() will do exactly what you're trying to avoid - looping
through all the records.
And should you have changes, it will be done again in Update().
It makes sense but I wasn't sure and I
haven't been able to find any documentation eitehr way. Whatever it is the
cost is trivial, but on a PPC resources are scarce it'd be worth noting.
Unfortunately, it's unlikely you can save same time with HasChanges().
Let me demonstrate with this pseudo code:
if (.HasChanges) { -> foreach(DataRow) { if (RowState != Unchanged )
return true} return false;
.Update() -> foreach(DataRow) { if (RowState != Unchanged )
UpdateRow()};
}
There's no reason to check all the rows twice, right?
Thanks,
Bill
www.devbuzz.com
www.knowdotnet.com
"Ilya Tumanov [MS]" said:
If you do not have any changes, DataAdapter won't actually update anything.
It will loop through all the records, make sure all of them are unchanged
and terminate.
This is exactly what you would have to do to check if you have changes.
So, there's no point to duplicate DataAdapter's work and check for changes
before calling Update.
That means you're doing the right thing already, no need to complicate
things.
Best regards,
Ilya
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "Eric" <
[email protected]>
References: <
[email protected]>
<
[email protected]>
Subject: Re: DataTable.HasChanges?
Date: Fri, 7 May 2004 14:53:07 -0500
Lines: 45
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
Message-ID: <#
[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: osh-197-nat-54.onshore.net 66.146.197.54
Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11