Master Detail with two DataGrids

M

Mauricio

I have a form with 2 DataGrids.
The first is bound with a parent table and the second is
bound with a child table. The update and delete rules of
the relation are Cascade.
When I change a parent's key column value and after I
click on the child DataGrid, the child DataGrid becomes
empty. Now, if I changed the parent's key column value and
click on another parent's row and after click on child
DataGrid, it's ok.
What do I need to do?
 
Y

Ying-Shen Yu[MSFT]

Hi Mauricio,
I can repro your problem, it seems the key value in the child datagrid
didn't get updated after the key value changed,I'm researching on it to see
if there is a work around to this. I'll update this issue as soon as I get
some result.
Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending, Thanks!
 
Y

Ying-Shen Yu[MSFT]

Hi Mauricio,

I'm still researching on your problem, it seems the child datagrid didn't
get updated correctly, if you call the Refresh method of the parent table's
currency manger, the child datagrid will show data correctly. I'm now
involving more people on this issue, I appreciate you patience when we look
into it, I'll reply to this thread as soon as I have some update to you.
Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending, Thanks!
 
Y

Ying-Shen Yu[MSFT]

Hi Mauricio,
You may get around this problem follow this KB article:
<BUG: A New Record That Is Added to a Parent DataGrid Control Does Not
Populate the Foreign Key Column in the Child DataGrid Control>
http://support.microsoft.com/?id=816227
This article is for adding a new record case, but as my test, the work
around also applies for modifying a primary key column.
Does it solve your problem?

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending, Thanks!
 
Y

Ying-Shen Yu[MSFT]

Here is some code snippet, I hope it's helpful to you.
<code>
private void Form1_Load(object sender, System.EventArgs e)
{
oleDbDataAdapter2.Fill(dataSet11);
oleDbDataAdapter1.Fill(dataSet11);
dataSet11.Tables["ParentTableName"].RowChanged += new
DataRowChangeEventHandler(Form1_RowChanged);
}

private void Form1_RowChanged(object sender, DataRowChangeEventArgs e)
{
// Get the Currency Manager
CurrencyManager myCurrencyManager =
(CurrencyManager)this.BindingContext[dataSet11, "ParentTableName"];
// Refresh the Currency Manager
myCurrencyManager.Refresh();
}
</code>
Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending, Thanks!
 
M

Mauricio

Hi Ying-Shen Yu [MSFT],
This code resolved the problem.
Thanks.
Best Regards,

Mauricio (Brazil)
ControlBase - Automation Systems
-----Original Message-----
Here is some code snippet, I hope it's helpful to you.
<code>
private void Form1_Load(object sender, System.EventArgs e)
{
oleDbDataAdapter2.Fill(dataSet11);
oleDbDataAdapter1.Fill(dataSet11);
dataSet11.Tables["ParentTableName"].RowChanged += new
DataRowChangeEventHandler(Form1_RowChanged);
}

private void Form1_RowChanged(object sender, DataRowChangeEventArgs e)
{
// Get the Currency Manager
CurrencyManager myCurrencyManager =
(CurrencyManager)this.BindingContext
[dataSet11, "ParentTableName"];
// Refresh the Currency Manager
myCurrencyManager.Refresh();
}
</code>
Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending, Thanks!

.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top