PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET Reading and writing to DataTable question

Reply

Reading and writing to DataTable question

 
Thread Tools Rate Thread
Old 22-06-2006, 12:26 PM   #1
J055
Guest
 
Posts: n/a
Default Reading and writing to DataTable question


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


  Reply With Quote
Old 23-06-2006, 03:37 AM   #2
Kevin Yu [MSFT]
Guest
 
Posts: n/a
Default RE: Reading and writing to DataTable question

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/d...-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/i...ew/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.)

  Reply With Quote
Old 07-08-2006, 10:47 PM   #3
J055
Guest
 
Posts: n/a
Default Re: Reading and writing to DataTable question

Hi Kevin

I'm now using typed DataSets which gives me what I need.

Thanks
Andrew


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off