G
Guest
I will explain the problem that i have with as much detail as i can.
I have an application developed using C# & SQL 2000. I am using a relational
database scheme.
The problem is present in this part of the application:
I have two tables, "Providers" & "Providers_Telephones", connected by a
relation:
1 Provider -> many Telephones.
I have created a DataSet that has the 2 tables and this relation defined.
I defined 1 Master DataGrid that contains all the Providers data and then a
Detail Datagrid connected by the relation that shows the Telephones of the
selected Provider.
I have created 4 Stored Procedures for each Table to do the following:
insert/mod/delete/select all.
Using 1 SQLDataAdapter for each table i fill the tables in the DataSet.
Up to here everything works as designed.
For testing purpose, i have manually added some Providers & Telephones.
When i want to mod a Telephone, i have no problems.
The problem appears when i want to add a new row, modify that new row and
delete a row. It looks like those changes NEVER took place in the DataSet, so
they are not updated in the Database.
I am using this for the "modification" operation:
this.dataSetProviders.Tables["Providers_Telephones"].RowChanged +=new
DataRowChangeEventHandler(ProvidersTelephone_RowChanged);
[...]
private void ProvidersTelephone_RowChanged(object sender,
DataRowChangeEventArgs e)
{
if (this.dataSetProviders.HasChanges())
{
this.sqlDataAdapterTelephones.Update(this.dataSetProviders.Providers_Telephones);
}
}
It looks like i do not know when the event to add the new/delete a Row
happens, so i am not confirming that change on the DataSet, so that change
never goes to the Database.
Any help on this will be great.
Thanks for your time.
I have an application developed using C# & SQL 2000. I am using a relational
database scheme.
The problem is present in this part of the application:
I have two tables, "Providers" & "Providers_Telephones", connected by a
relation:
1 Provider -> many Telephones.
I have created a DataSet that has the 2 tables and this relation defined.
I defined 1 Master DataGrid that contains all the Providers data and then a
Detail Datagrid connected by the relation that shows the Telephones of the
selected Provider.
I have created 4 Stored Procedures for each Table to do the following:
insert/mod/delete/select all.
Using 1 SQLDataAdapter for each table i fill the tables in the DataSet.
Up to here everything works as designed.
For testing purpose, i have manually added some Providers & Telephones.
When i want to mod a Telephone, i have no problems.
The problem appears when i want to add a new row, modify that new row and
delete a row. It looks like those changes NEVER took place in the DataSet, so
they are not updated in the Database.
I am using this for the "modification" operation:
this.dataSetProviders.Tables["Providers_Telephones"].RowChanged +=new
DataRowChangeEventHandler(ProvidersTelephone_RowChanged);
[...]
private void ProvidersTelephone_RowChanged(object sender,
DataRowChangeEventArgs e)
{
if (this.dataSetProviders.HasChanges())
{
this.sqlDataAdapterTelephones.Update(this.dataSetProviders.Providers_Telephones);
}
}
It looks like i do not know when the event to add the new/delete a Row
happens, so i am not confirming that change on the DataSet, so that change
never goes to the Database.
Any help on this will be great.
Thanks for your time.