Reading and writing to DataTable question

J

J055

Hi

If I fill an untyped DataTable from my SQL stored procedure to present into
some web form for manipulation, how should I write the updates back to the
DataTable for saving to another insert procedure?

Should the schema be stored in memory somewhere? It would be nice to have it
as part of a business object but I'm not sure how to store the schema as a
property. I guess I could make a another call to the original data object to
get the schema before I need to update the DataTable? but that seems
wasteful on database connections and doesn't seem quite right to me.

I'm looking to develop a fairly simple n-tier application so could do with
some pointers on this.

Thanks
Andrew
 
K

Kevin Yu [MSFT]

Hi Andrew,

Do you mean that you need to update the DataTable from the changes that
performed on the webpage? If so, try data binding on the webform. This also
depends on the what controls you're using on the webpages. If simple
controls like TextBoxes, you have to assign the changed value back to
DataSet, like the following:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
vbtskupdatingexistingrecordsindataset.asp

Also, there is a control named GridView which can auto-update the DataTable
from UI with data binding. Here is a good article for your reference.

http://msdn.microsoft.com/msdnmag/issues/04/08/GridView/default.aspx

Since this is an untyped DataSet, the schema is inferred from the filling
data, I don't think we need to stored schema information. Because next time
you do the filling, the same schema will be created automatically again.

Kevin Yu
Microsoft Online Community Support

============================================================================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
============================================================================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

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