RE: Using UPDATE I con't write the dataset back to datasource by BJ
BJ
Fri Jun 24 23:07:01 CDT 2005
Oops! I forgot to attach the code.
private void btnSave_Click(object sender, System.EventArgs e)
{
try
{
DataSet changedData = customerDataSet1.GetChanges();
if (changedData != null)
{
// customerDataSet1.Tables["tblCustomer"].Rows[0]["CarNo"] = textBox1.Text;
//customerDataSet1.Tables["tblCustomer"].Rows[0]["Name"] = textBox2.Text;
sqlDataAdapter1.Update(customerDataSet1);
MessageBox.Show("Database updated!");
customerDataSet1.AcceptChanges();
}
else
{
MessageBox.Show("Nothing to save", "No changes");
}
}
catch(Exception ex)
{
MessageBox.Show("An error occurred updating the database:"+"ex.Message",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
customerDataSet1.RejectChanges();
}
}
"B.J." wrote:
> It works fine with the datagrid but with the sqlAdapter. Here is the code I
> was using. if State is always undefined. so it skips the logic, but the
> Textboxes hold the changed information. I am learning, please advise. Thanks