ASP.NET/SQL performance

Associate
Joined
24 Jul 2003
Posts
1,420
Location
West Mids
I'm working on a CMS/e-learning type web app and just wondering how best to handle the following:

* User updates information on a page and this info is updated in the database.
* Updated info needs to be displayed on the page after PostBack - which would be the most efficient way to do this?
* Info is stored in a DataTable object

1) Include a SELECT statement in the stored proc when updating the database and output this to a new DataTable object.

2) Loop through the existing DataTable object and update the rows required.

Since I have to make a database call to update the database anyway, am I going to incur much of a performance overhead by adding in the SELECT statement?

Just wondering if anyone has any opinions on whether one option is better than the other? :)
 

~J~

~J~

Soldato
Joined
20 Oct 2003
Posts
7,558
Location
London
If you drag onto your webform a datagrid and apply the necessary databinding methods, all of what you're wanting to do would be easily achieved.

Any ammendments to an exisiting record would be handled for you in codebehind without you having to write a single bit of code and these would be updated on the server side and presented to the user with even something like a "record updated" message so they know their request has been fulfilled.
 
Soldato
Joined
28 Aug 2006
Posts
2,980
If your doing a PostBack then you could use the ViewState to repopulate the page elements rather than making another call to the DB.

You can perform the update to the DB as normal.

C#
Code:
if (!Page.IsPostBack)
{[INDENT]Page not a post back, go get the DB info.[/INDENT]
}
else
{[INDENT]Page postback.[/INDENT]
}
 
Top Bottom