C#Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
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.
//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...
Here are some suggestions
Try calling the AcceptChanges method of the dataset
vehiclesDataSet1.Cars.Rows.Add(newCarsRow);
vehicleDataSet1.Cars.AcceptChanges();
(Dont know if u would need to call the carsTableAdapter1.Update(newCarsRow); manually in that case).
quote:Originally posted by sreeramv
Lemme know if this helps
With or without the Update method, I still need to restart the application to have the changes reflected in the combobox. However, I appreciate your help! Please give me any ideas you have!
Computers will never surpass the human brain; no computer will ever be able to replicate human stupidity.