A
Alastair Anderson
I have created a very simple form with which I would like to update a
single
value in a single row of a database as a proof of concept.
The relevant parts of the form are a DBWebTextBox (which is hooked
into a
column ORGANISATION.SHORT_NAME) and a Button which I am using as a
submit
button.
I have the form updating the database correctly, but only after the
submit
button is clicked twice, which is not the intended behaviour for this
application.
I placed a break point within the OnClick method to see what is
happening, however the first time I click the button the event handler
is
never run, but I also have a DBWebNavigator control on my form and
that seems
to update correctly (allowing the Undo of the update) on the first
click, but
only on the second click does the event handler get run.
The event handler code is as follows...
private void btnSubmit_Click(object sender, System.EventArgs e)
{
int rowsUpdated;
bdpDataAdapter1.UpdateCommand.CommandText =
"UPDATE ORGANISATION SET SHORT_NAME = '" +
dbWebTextBox2.Text +
"' WHERE NAME = '" +
dbWebTextBox1.Text +
"'";
rowsUpdated = bdpDataAdapter1.Update(dataSet1);
bdpConnection1.Open();
bdpUpdateCommand1.ExecuteNonQuery();
bdpConnection1.Close();
dataSet1.AcceptChanges();
}
the only other event handler that I have is the Page_Load method,
however that does not have any code within it.
I was just wondering if I am missing anything in the order of
execution
Many thanks in advance
single
value in a single row of a database as a proof of concept.
The relevant parts of the form are a DBWebTextBox (which is hooked
into a
column ORGANISATION.SHORT_NAME) and a Button which I am using as a
submit
button.
I have the form updating the database correctly, but only after the
submit
button is clicked twice, which is not the intended behaviour for this
application.
I placed a break point within the OnClick method to see what is
happening, however the first time I click the button the event handler
is
never run, but I also have a DBWebNavigator control on my form and
that seems
to update correctly (allowing the Undo of the update) on the first
click, but
only on the second click does the event handler get run.
The event handler code is as follows...
private void btnSubmit_Click(object sender, System.EventArgs e)
{
int rowsUpdated;
bdpDataAdapter1.UpdateCommand.CommandText =
"UPDATE ORGANISATION SET SHORT_NAME = '" +
dbWebTextBox2.Text +
"' WHERE NAME = '" +
dbWebTextBox1.Text +
"'";
rowsUpdated = bdpDataAdapter1.Update(dataSet1);
bdpConnection1.Open();
bdpUpdateCommand1.ExecuteNonQuery();
bdpConnection1.Close();
dataSet1.AcceptChanges();
}
the only other event handler that I have is the Page_Load method,
however that does not have any code within it.
I was just wondering if I am missing anything in the order of
execution
Many thanks in advance