PC Review


Reply
Thread Tools Rate Thread

datagrid master-detail bug?

 
 
=?Utf-8?B?QnJhZA==?=
Guest
Posts: n/a
 
      29th Apr 2004
Let me run through the first problem I had with a master-detail setup on two Windows datagrids, as it may relate to the second problem
I have two datagrids set up for master-detail as recommended by Microsoft. That is, something like this
dataGridMaster.SetDataBinding( dataset, dataset.masterTable.TableName )
dataGridDetail.SetDataBinding( dataset, dataset.masterTable.TableName + ".actualrelationname" )

The first problem I had was if the user edits a [non-key] value in one of the detail rows and then clicks on a master row OTHER THAN the master for the detail he just edited, the edited value is applied to the newly-selected master's detail row, rather than to the detail row that was actually edited. Hopefully someone can follow that statement

Let's use the customer-order example. Say I have customers A and B. I have clicked on customer A in the master grid and am thus displaying orders A-1 and A-2 in the details grid. I edit order A-1 and, say, change the shipping method from FedEx to UPS. Then I click on customer B in the master grid. The problem is that the new shipping method UPS is applied to order B-1 because I clicked on customer B
I stripped my code to the barest essentials (basically just doing the SetDataBinding calls on the grids) and always had this problem. My workaround was to force an EndEdit on the current details cell any time I left the datagrid or the form closed. Fine, fixed the problem

That being said, the second problem I cannot find a workaround for is this
I have entirely new customers and orders in my tables, which received negatively-incrementing autogenerated primary keys. When saved to the database, a stored procedure returns the new SQL Server-generated keys and everything's fine. The customer-order relation has cascading updates and so, when the customers table is saved, the new keys cascade down to the orders, and then the orders are saved and everybody's happy
HOWEVER
Any order that has been edited in the details datagrid (and ONLY THOSE that have been edited in the datagrid) prior to saving somehow breaks the cascading updates, ONLY for rows that have been edited in the datagrid. So when the new customers get their new SQL primary keys via the stored procedure, the new keys don't cascade to the orders and then SQL Server rightly throws a foreign key violation since we're now trying to save orders that still have the local negative keys
I can edit new customers and orders via other non-datagrid methods and have no problems whatsoever

At a minimum all I'm looking for is confirmation that this is a framework bug and I'm not crazy. At best, a workaround or patch is what I seek

Thanks to all for reading this and any suggestions you may have.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?a2VuIGNodW5n?=
Guest
Posts: n/a
 
      27th May 2004
Totally agree and hit the same problem
No work aroun

I think this bug cost me a lot of afford to redevelop my code :-(
 
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
master/detail datagrid mfleet1973@yahoo.ca Microsoft VB .NET 0 13th Jul 2006 02:05 PM
Master-Detail DataGrid with conditional (detail) formatting John Sitka Microsoft Dot NET Framework Forms 0 4th Nov 2005 08:50 PM
Reproducible bug in Master-Detail DataGrid when RowFilter applied to Master jgbailey@gmail.com Microsoft Dot NET Framework Forms 0 21st Oct 2005 08:19 PM
Filtering the Detail Datagrid in a Master Detail Relationship =?Utf-8?B?Qm9i?= Microsoft ADO .NET 1 19th Dec 2004 08:00 PM
DataGrid: Master-Detail LrKr Microsoft Dot NET Framework Forms 1 28th Sep 2003 04:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:04 AM.