Fill(d Set, "My Table") d Table = New Data Table d Table = d Set. Specifying the values twice is not only a minor annoyance.Tables("My Table") sql Cmd = New Sql Command("INSERT INTO My Table (Col1, Col2) VALUES (@Val1, @Val2)", sql Conn) With sql Cmd . It might also mean a high risk for a Data Integrity bug like in this example where the data is set directly.When you call the Update method, the Data Adapter analyzes the changes that have been made and executes the appropriate command (INSERT, UPDATE, or DELETE).
So if you would try to omit that line the changes doesn't reflect in your datasource as what you have noticed..
This is the reason why I am asking whether it is mandatory to update the Data Table first before updating the data source? As what i have observed in your code you are just Updating the values from your Database and not in the Data Table so thats why its mandatory to have that line you have commented out..
It has been working fine, until I switched computers.
Now the Dataset is being updated, but the Database is not. Command Text from the two and they are exactly the same as are the Item Array data elements. In order to update the data on the database your Sql Data Adapter need to have its Insert Command, Update Command, Delete Command properties set.
This allows you to maximize the performance of your ADO.
NET application by specifying command syntax at design-time and, where possible, through the use of stored procedures. Tables("My Table")) When I run the above script, a new row gets added to the data source, correct? Sql Client; private void Insert Data() protected void Button1_Click(object sender, Event Args e) Vinz, I don't think you have understood my question yet.I'm sure there is an extremely simple reason that this one line isn't working, but it has evaded for the past week, so I'm hoping someone else will notice my fault. Here is the full code of this form: private void exit Tool Strip Menu Item_Click(object sender, Event Args e) private void go Back Tool Strip Menu Item_Click(object sender, Event Args e) private void help Tool Strip Menu Item_Click(object sender, Event Args e) Sql Connection con; Sql Data Adapter data Adapt; Data Set data Recipe; Sql Command Builder cb; int Max Rows = 0; int inc = 0; private void Edit Recipe_Load(object sender, Event Args e) private void Navigate Records() private void btn Next_Click(object sender, Event Args e) private void btn Back_Click(object sender, Event Args e) private void btn Save_Click(object sender, Event Args e) private void btn Delete_Click(object sender, Event Args e) Did you ever get an answer on this? I don't really understand all of the parameters in the auto-generated INSERT command, though. The Sql Command Builder instance that you've created has these commands but you need to set them to your Sql Data Adapter. I am having the same problem with a project I built to handle my Db updates. In other worlds: Somewhere between I had the same issue: Filled a new Dataset with some new rows, but nothing happened on update. For example, the following call to Update writes changes from the Data Table named Categories back to the SQL Server table of the same name: statement that was provided to the Sql Data Adapter object or can be explicitly provided to the Sql Data Adapter object. When the Update method is called, the Sql Data Adapter object notes that no values have been set for its Update Command, Insert Command, and Delete Command prperties, and therefore queries the Sql Command Builder object for these commands. row("Description") = "Milk and stuff" ' Perform the update. Update(ds, "Categories") ' Close the database connection.