Manually changing a dataset and updating

  • Thread starter Thread starter Michael Jackson
  • Start date Start date
M

Michael Jackson

In my VB.NET 2003 Winforms app I fill a typed dataset with 1 record from SQL
Server. I'm not using databinding on my form, so I want to programatically
change values in the dataset with values from textboxes and listboxes, then
update the SQL Server table with the changed dataset.

I've sucessfully loaded the dataset and displayed it's values in the form
controls, but I don't know how to update the dataset with changes I've made
in the form controls, nor how to save back to the db.

I've always used databinding, so I'm a little stumped here.

Any help would be greatly appreciated.

Michael
 
Hi,

First, since you did not bind DataSet to the controls, you need to assign
values from the controls to the DataTable inside of the DataSet. For example

MyDatSet.Tables("MyTable").Rows(0).Item("MyColumn")=TextBox.Text

Now you need to update database calling Update method of the DataAdapter and
passing DataSet as a source
 
Back
Top