Database changes not recognized until restart
Hello! I'm a newb, especially to databases, so bear with me. I'm writing a program which, ultimately, takes the value of textboxes and writes them to the database. The code to accomplish this is below. However, the changes don't seem to appear in the combobox (which contains all of the entries for a specific column of data) until after the application is restarted. Why is this? Thank-you in advance.
-----------------------------
private void btnSave_Click(object sender, EventArgs e)
{
//Put textbox values into variables
string txtMakeValue = txtMake.Text;
string txtModelValue = txtModel.Text;
int txtYearValue = Convert.ToInt32(txtYear.Text);
double txtMileageValue = Convert.ToDouble(txtCurrentMileage.Text);
//Create new row and fill in data
VehiclesDataSet.CarsRow newCarsRow = vehiclesDataSet1.Cars.NewCarsRow();
newCarsRow.Make = txtMakeValue;
newCarsRow.Model = txtModelValue;
newCarsRow.Year = txtYearValue;
newCarsRow.Mileage = txtMileageValue;
//Add new row
vehiclesDataSet1.Cars.Rows.Add(newCarsRow);
carsTableAdapter1.Update(newCarsRow);
}
Computers will never surpass the human brain; no computer will ever be able to replicate human stupidity.
__________________
If only computers could write programs themselves...
|