PC Review


Reply
Thread Tools Rate Thread

DataTable.LoadDataRow -Documentation error!!!

 
 
John Viele
Guest
Posts: n/a
 
      6th Aug 2003
The documentation of DataTable.LoadDataRow() has a major omission. To
quote:

"Finds and updates a specific row. If no matching row is found, a new row is
created using the given values."

What this does NOT tell you is that it ignores any rows which have the
INSERTED or UPDATED flags set. It only correctly updates the data table if
you have already called AcceptChanges() on your data table.

Well, this little omission costed me HOURS of work. I designed a routine
to update an entire dataset (including a number of data tables) in one big
swoop so that I can call Update() inside a transaction to do all the inserts
and updates at one time. Unfortunately, that routine fails miserably due to
duplicated keys. This occurs when you call LoadDataRow() more than once
with the same primary key expecting an UPDATE to an existing row AS THE
DOCUMENTATION STATES!

At a minimum the documentation needs to be corrected. On the other hand,
most every other function that can affect rows in the data table gives you
the ability to specify flags indicating which rows to ignore. Why on earth
wouldn't that be available on this function?


 
Reply With Quote
 
 
 
 
codewriter
Guest
Posts: n/a
 
      6th Aug 2003
Yep, one more example showing that it would be better to use business
objects and not to rely on DataTables and DataSets.
IMHO.

"John Viele" <johnv@{NO_SPAM}goisc.com> wrote in message
news:%23quPF%(E-Mail Removed)...
> The documentation of DataTable.LoadDataRow() has a major omission. To
> quote:
>
> "Finds and updates a specific row. If no matching row is found, a new row

is
> created using the given values."
>
> What this does NOT tell you is that it ignores any rows which have the
> INSERTED or UPDATED flags set. It only correctly updates the data table

if
> you have already called AcceptChanges() on your data table.
>
> Well, this little omission costed me HOURS of work. I designed a routine
> to update an entire dataset (including a number of data tables) in one big
> swoop so that I can call Update() inside a transaction to do all the

inserts
> and updates at one time. Unfortunately, that routine fails miserably due

to
> duplicated keys. This occurs when you call LoadDataRow() more than once
> with the same primary key expecting an UPDATE to an existing row AS THE
> DOCUMENTATION STATES!
>
> At a minimum the documentation needs to be corrected. On the other hand,
> most every other function that can affect rows in the data table gives you
> the ability to specify flags indicating which rows to ignore. Why on

earth
> wouldn't that be available on this function?
>
>



 
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
DataTable.LoadDataRow - can you improve on this? Jim Lawton Microsoft ADO .NET 4 1st Dec 2004 11:52 AM
DataTable.NewRow and DataTable.LoadDataRow Ashish Sheth Microsoft ADO .NET 3 7th Jul 2004 04:23 PM
DataTable.LoadDataRow Huang Xin via .NET 247 Microsoft ADO .NET 1 23rd Apr 2004 07:39 AM
DataTable.LoadDataRow -Documentation error!!! John Viele Microsoft ADO .NET 1 6th Aug 2003 04:43 PM
DataTable.LoadDataRow -Documentation error!!! John Viele Microsoft C# .NET 1 6th Aug 2003 04:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:18 PM.