I've got a problem when adding data to the database. I'm using a wizard and have written the data set on the page behind.
When adding data to the incident table, the final part of the code looks like this:
//Create the command builder
OleDbCommandBuilder cb = new OleDbCommandBuilder(adaptor);
//retrieve an updated table adaptor
adaptor = cb.DataAdapter;
//update the database using the dataset
con.Open();
//Response.Redirect("Finishrecord.aspx");
added = adaptor.Update(dsIncident,
"tblincident");
Response.Write(added.ToString() +
" records added");
}
catch (Exception err)
{
Response.Write(
"Error adding record");
Response.Write(err.Message);
}
finally
{
con.Close();
}
I put this line in
Response.Write(added.ToString() + " records added");
In the development phase, to check the database was updating. What I really want to happen is to redirect to another page, hence the commented out
Response.Redirect("Finishrecord.aspx");
What appears to be happening is as soon as I put this line in, the database ceases to update, but if I comment it out it works fine. So I've fiddled around with where this line should go, but nothing seems to work. I'm sure it's simple enough, but I'm just not seeing it.
Please could somebody point out to me where I'm being such an idiot?