Sharepoint webpart data states
Posted on 2009-12-18
Greeings all experts,
If your grid takes 5 minutes to retreive records (Please don't ask why, I learned not to in my current position ;) ) then essentially you are regenerating that query each time someone chooses to do something on the page.
My goal was to prevent this. I want to query the data once, store it in objects, then reference the objects each time I need the data.
I would like it to persist in memory until the functions are complete.
//gathers connection string information
// interface to connection string
//Here is where I want to display the data.
Currently I am thinking something like this
call the interface to get the database connection string and open a connection
//set a List<T> which will be static as I don't want to regenerate this
LoadData(); //LoadData will open the database, and fill a datatable with data
_data = new DataLoad();
List<t> = _data.LoadObjects(_datatable) // After this is done, I don't want to bother with the connection, LoadData method, i don't even want to relaod this list when a user changes parameters.
//Here is where I am generating the grid for my data display.
Now the question.
when I call the LoadObjects(_dataTable). The datatable is not always avalable.
Do I have the right Idea in developing this or is the requerying of the database necessary?