M
mdhaman
Hi,
I have an issue in updating the Primary Key in the Parent table. I have set
of three tables (Database SQL2000, VB.NET), where A is related to B and B is
related to C. I have written a stored procedure which returns all the
records in these tables and fill up a single DataSet. All these table have
primary key which is an Identity Column. The dataset then populates the
three grids in the client application. The users can add/update/delete the
values in all the three tables and there is single save button to do the
updates.
I am code I have created DataRelation between table A,B and C. Also when I
add a new add to the child table, I set the parent row as well. All these is
working fine. I am using the example as described in the CodeProject article
http://www.codeproject.com/cs/database/relationaladonet.asp?df=100&forumid=14883
But my problem here is when I add a row in the Parent table say A and then
add new rows in the child table B. The new generated ID in the Parent table
is not propagated to the rows in the child table.
I am using RowUpdated event to capture get the latest ID returned from the
stored procedure as output parameter. I use the latest ID to update the
datatable.
When I debug the application, I can retrieve the new ID in the RowUpdated
event and set it back to the datarow:
e.Row.Item("ColumnName") = newID.
e.Row.AcceptChanges()
But these changes are not seen in the dataset. It still has same old ID but
in the DEBUG mode the e.row has the new value.
Moreover, its an issue because the event arguments are passed as Byval and
not as ByRef. i.e. I am not getting the actual reference to the DataRow.
Has anybody faced this problems before? Please help...
I have an issue in updating the Primary Key in the Parent table. I have set
of three tables (Database SQL2000, VB.NET), where A is related to B and B is
related to C. I have written a stored procedure which returns all the
records in these tables and fill up a single DataSet. All these table have
primary key which is an Identity Column. The dataset then populates the
three grids in the client application. The users can add/update/delete the
values in all the three tables and there is single save button to do the
updates.
I am code I have created DataRelation between table A,B and C. Also when I
add a new add to the child table, I set the parent row as well. All these is
working fine. I am using the example as described in the CodeProject article
http://www.codeproject.com/cs/database/relationaladonet.asp?df=100&forumid=14883
But my problem here is when I add a row in the Parent table say A and then
add new rows in the child table B. The new generated ID in the Parent table
is not propagated to the rows in the child table.
I am using RowUpdated event to capture get the latest ID returned from the
stored procedure as output parameter. I use the latest ID to update the
datatable.
When I debug the application, I can retrieve the new ID in the RowUpdated
event and set it back to the datarow:
e.Row.Item("ColumnName") = newID.
e.Row.AcceptChanges()
But these changes are not seen in the dataset. It still has same old ID but
in the DEBUG mode the e.row has the new value.
Moreover, its an issue because the event arguments are passed as Byval and
not as ByRef. i.e. I am not getting the actual reference to the DataRow.
Has anybody faced this problems before? Please help...