First of all let me say that I am very new to .NET and C#
and I need help so please bear with me. I have a tree
control that is dynamically populated from a dataset of
two joined tables. When a node is selected a groupbox is
displayed on the right that has textboxes to display
fields in the data set from the selected row. The fields
are bound to the proper dataset column via the design
properties page. The selected node shows the group box and
then calls a method to populate the items in the group box
passing the primary key for that row in the table. All
this works fine the group box displays the appropriate
information for the selected tree node. However when I add
a update button and change any data the updates dont
happen and no errors, just no changes to the data. I had
thought that any fields bound to a dataset at design time
would automatically reflect thier changes in the dataset.
Here is the method that fills the groupbox:
private void FillMaterialData(string MatNo)
{
if(MatNo != null)
{
DataRow currentRow;
currentRow = dataSet11.MATERIALS.Rows.Find(MatNo);
materialGroupBox.Text = "Material No. = " + MatNo;
matNameTB.Text = System.Convert.ToString(currentRow
["MATNAME"]);
matDescTB.Text = System.Convert.ToString(currentRow
["MATDESC"]);
}
}
And here is the simple update event:
private void btnUpdate_Click(object sender,
System.EventArgs e)
{
sqlDataAdapter1.Update(dataSet11);
sqlDataAdapter2.Update(dataSet11);
MessageBox.Show("Data Updated!");
}
Thanks in advance for any help.
.
and I need help so please bear with me. I have a tree
control that is dynamically populated from a dataset of
two joined tables. When a node is selected a groupbox is
displayed on the right that has textboxes to display
fields in the data set from the selected row. The fields
are bound to the proper dataset column via the design
properties page. The selected node shows the group box and
then calls a method to populate the items in the group box
passing the primary key for that row in the table. All
this works fine the group box displays the appropriate
information for the selected tree node. However when I add
a update button and change any data the updates dont
happen and no errors, just no changes to the data. I had
thought that any fields bound to a dataset at design time
would automatically reflect thier changes in the dataset.
Here is the method that fills the groupbox:
private void FillMaterialData(string MatNo)
{
if(MatNo != null)
{
DataRow currentRow;
currentRow = dataSet11.MATERIALS.Rows.Find(MatNo);
materialGroupBox.Text = "Material No. = " + MatNo;
matNameTB.Text = System.Convert.ToString(currentRow
["MATNAME"]);
matDescTB.Text = System.Convert.ToString(currentRow
["MATDESC"]);
}
}
And here is the simple update event:
private void btnUpdate_Click(object sender,
System.EventArgs e)
{
sqlDataAdapter1.Update(dataSet11);
sqlDataAdapter2.Update(dataSet11);
MessageBox.Show("Data Updated!");
}
Thanks in advance for any help.
.