Best way to add/modify/delete data in a datagrid

I have a Visual Studio 2008 .NET 3.5  web application that uses datagrids. I need to add/modify/delete rows in those datagrids. Currently when a row is added, the database is hit there and then, i.e. I don't store a number of rows to be added and then do a batch insert.

At the moment a datagrid will have a pagesize of e.g. 8. i.e. the database loads 8 records at a time and is hit every time a datagrid page change occurs. Would I be better off in terms of time to:

a) Load all of the datagrid data into a dataset (could be 1000's of rows) and upon adding a row to the dataset just update the database with that row on a row by row basis (not a batch insert)?

b)  Stick with the paging method above i.e. load a new page from the database every time. Upon adding  a new row simply update the database with that row?

c) Load all of the datagrid data into a dataset (could be 1000's of rows) and upon adding a row to the dataset don't update the database until a commit button is pressed therefore allowing for a batch update of rows?

d) Have a separate add/modify screen so that new data can be added to a smaller dataset (the add/modify dataset) and keep the paging as above so that for e.g. if you are looking for a row in the datagrid to update you find it by whatever method (search or page number) with the requisite database hit. Then you modify the row and that modification is placed in the smaller add/modify dataset and can be committed whenever. This would avoid the loading of all of the datagrid data into a dataset.

I am leaning towards d) but not in a position to implement it yet (time!) therefore which of a) to c) would be the best way forward in the interim. c) would be the neatest method but would there be a large hit in terms of performance - there are several datagrids on a page and they would all be implemented using this method.


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

i would choose c) and update the database on the server only on user action (but that has to be clearly pointed to the user so they wont expect any change to be persistent unless pressing save/commit or something)


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.