c# how can I use a temporary table to collect and display data before writing it permanently into the database.
Posted on 2007-04-04
I have an aspx page that conatins a gridview a dropdownlist a textbox and a button.
I use a tableadapter to bind a table to the dropdownlist.
The user selects an item from the ddl enters a value into the textbox and click the button.
Based on what the user selects and enters rows need to get added to teh table that is bound to the grid view.. So the grid view basically gets populated as the user is selecting items from the ddl and clicking the button.
Eventualy the user will click another button and the values in teh grid view will get written to a series of tables in the database.
My question is this...what is the best approach to handling the table that is bound to the gridview.
I have though about creating a programmatic table and having it be persistent while the page is active and binding it to the gridview though I havent quite worked out how to accomplish that yet.
Easier stil would be to have an empty table in teh database that I could bind to the gridview throgh a tableadapter and just write the values to that table..then at the end write those values to their legitimate tables in the database and finish up with deleting everything in this "temp" table location.
I am guessing that there is a best practice to follow in this regard..some kind of system that allows me to collect data into a "temporary table" that I can display in a gridview before finally writing that data to a database...