Dataset binding in reverse

P

PartyFears

Dear All,

I have the following problem.

I have populated a datasset and bound the contents to varous text
fields defined in a page. I do this through running Me.Databind in
the Form_Load of the page concerned. The dataset will only contain
one table and one row within the table.

Up to this point everything is OK.

One the form is displayed, the user is free to change any of the
values. A button is supplied to submit the form at which point I want
to update the dataset and apply the changes to my datasource - at this
stage I'm not too sure whether this will be a SQL database or xml
file.

I know that I can [on postback] build the dataset again, get the
contents of each of the controls on the form and update the dataset

eg.
dim ds as Dataset

ds = buildDataset()

ds.tables(0).rows(0).item("ClientName") = txtClientName.text
ds.tables(0).rows(0).item("ClientAddress") = txtClientAddress.text

etc....

Ideally, I'm looking for a way to automatically update the dataset in
the same way that the databind function automatically updates the form
controls.

Is my example above the recommended way to do this or can it be done
more gracefully....

Thanks in advance,

Jan-Willem Wilson.
 
M

michael

When you created your dataset, the wizard in VS.NET sets this up for you
automatically and if it can't it warns you that it can't create an
update/insert sql. Try generating the dataset again to see what I am
talking about in VS.NET.
 

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