Manually changing a dataset and updating

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
 
V

Val Mazur \(MVP\)

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top