开发者

Update DataBase on button click, after editing gridview (not automatically saving in DB, but after confirming on any event) within using transactions

开发者 https://www.devze.com 2022-12-25 17:10 出处:网络
0vote downstar I am using GridView in asp .net and editing data with edit command field property (as we know after updating the edited row, we automatically update the database), and I want to use tr

0 vote down star

I am using GridView in asp .net and editing data with edit command field property (as we know after updating the edited row, we automatically update the database), and I want to use transactions (with begin to commit statement - including rollback) to commit this update query in database, after clicking in some button (after some events for example), not automatically to insert or update the edited data from grid directly to the DB...so I want to save them somewhere temporary (even many edited rows - not just one row) and then to confirm the transaction - to update the real tables in database...

I've used some good links, but very helpful, like:

http://www.asp.net/learn/data-access/tutorial-63-cs.aspx

http://www.开发者_运维问答asp.net/learn/data-access/tutorial-66-cs.aspx etc... etc...


Well, there are many options to save data, session, cache, XML file, but the thing you have to be careful of is to maintain the association between the cached data and the batch process. Session or cache you have to be concerned with timeouts; disk IO is pretty safe, though you just have to maintain the association between the saved data and the user. How long do you want to save the previous entries?

Other things to consider are what if they close the browser and come back? You can tie the data to a user's session ID, but if that session closes or restarts (issuing a new ID), the user would have to start all over again...

You could tie data to user name, if you require authentication, and then simply read the files from session, cache, disk IO, etc. to get the previously saved data, and reload when they come back. It depends on how long you want to store the data, does it naturally time out if they don't get around to submitting it? If two days down the road, should they be able to come back and start where they left off?

HTH.

0

精彩评论

暂无评论...
验证码 换一张
取 消