strategy for when to update DB from dataset [modified]
-
Hi, What event should I use to trigger an update of a dataset to the originating DB, in order to take max advantage of dataset scalability without losing data? I'm building an ASP .NET website driven by an SSE database. Hopefully there will be several thousand users. When a user logs on, the codebehind queries the DB and retrieves up to several dozen records belonging to that user. The user can add, delete, and modify records on several webforms. I'm using a dataset and SqlDataAdapter to get the records at login and caching them in the Session object. Right now I'm calling
SqlDataAdapter.Update(dataset)
every time the user submits a webform with a new record. That works, but it doesn't seem very efficient. But I can't figure out how else to do it without potentially losing records. What if the user enters a record, and then closes the browser window? What if he times out or goes to another website before my Update method runs? How do I take better advantage of datasets and data adapters? Is there a way to detect the end of a Session and set up an event handler to run an update then? Or maybe cache to the Application and run an update on time intervals? I apologize if this question is elementary. I'm early in the learning process for C# / ASP .NET / ADO. TIA -- modified at 0:15 Wednesday 5th July, 2006 -
Hi, What event should I use to trigger an update of a dataset to the originating DB, in order to take max advantage of dataset scalability without losing data? I'm building an ASP .NET website driven by an SSE database. Hopefully there will be several thousand users. When a user logs on, the codebehind queries the DB and retrieves up to several dozen records belonging to that user. The user can add, delete, and modify records on several webforms. I'm using a dataset and SqlDataAdapter to get the records at login and caching them in the Session object. Right now I'm calling
SqlDataAdapter.Update(dataset)
every time the user submits a webform with a new record. That works, but it doesn't seem very efficient. But I can't figure out how else to do it without potentially losing records. What if the user enters a record, and then closes the browser window? What if he times out or goes to another website before my Update method runs? How do I take better advantage of datasets and data adapters? Is there a way to detect the end of a Session and set up an event handler to run an update then? Or maybe cache to the Application and run an update on time intervals? I apologize if this question is elementary. I'm early in the learning process for C# / ASP .NET / ADO. TIA -- modified at 0:15 Wednesday 5th July, 2006Run the code SessionEnd event as well if its a ASP.NET web page. Look where you want to go not where you don't want to crash. Bikers Bible