I'm new to C#, so pardon any assumptions I make...
I have 2 datatables, in a dataset. both bound to their own datagrid. The idea would be that the user scrolling through datagrid one would see the records in datagrid2 get updated with the child records from Table1.
Tables are as follows:
Table1:
TableName Synch
Table2:
TableName FieldName Synch
Table1 being a list of Tables in database and Table2 a list of Fields in the Table.
In the Beginning of the app, I use a different sqladapter for each table to fill DataSet1
In dataGrid's CurrentCellChanged Event I have added the Folowing 2 lines of Code to update what should be in the child table/dataGrid:
sqlDataAdapter2.SelectCommand.CommandText = "Select * from tblUpdataeFields Where TABLENAME = '" + dataSet1.tblUpdateTables.Rows[dataGrid1.CurrentRowIndex][0].ToString() + "'";
sqlDataAdapter2.Fill(dataSet1, "tblUpdateFields");
Of course they generate a nice error:
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll
Additional information: System error.
Any assistance on how to handle this would be greatly appreciated. As I'm a newbie to C#, I'd prefer to do this in code as a learning exercise rather than interactively in the IDE.
TIA,
cmgaviao
I have 2 datatables, in a dataset. both bound to their own datagrid. The idea would be that the user scrolling through datagrid one would see the records in datagrid2 get updated with the child records from Table1.
Tables are as follows:
Table1:
TableName Synch
Table2:
TableName FieldName Synch
Table1 being a list of Tables in database and Table2 a list of Fields in the Table.
In the Beginning of the app, I use a different sqladapter for each table to fill DataSet1
In dataGrid's CurrentCellChanged Event I have added the Folowing 2 lines of Code to update what should be in the child table/dataGrid:
sqlDataAdapter2.SelectCommand.CommandText = "Select * from tblUpdataeFields Where TABLENAME = '" + dataSet1.tblUpdateTables.Rows[dataGrid1.CurrentRowIndex][0].ToString() + "'";
sqlDataAdapter2.Fill(dataSet1, "tblUpdateFields");
Of course they generate a nice error:
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll
Additional information: System error.
Any assistance on how to handle this would be greatly appreciated. As I'm a newbie to C#, I'd prefer to do this in code as a learning exercise rather than interactively in the IDE.
TIA,
cmgaviao