Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cached Datasets vs Data Readers

Status
Not open for further replies.

MDTekUser

Technical User
Dec 25, 2005
68
US
I am designing a web form that allows the user to add, edit, delete and update records. The form will also have 2 subforms of related data that will be displayed in 2 datagrids.

Would I add any better scalability if I used data readers to populate the main form and subforms with data and then use a command object to call a stored proc? It involves more coding. Is this worth the effort?

In Visual Basic I liked creating unbound forms and only using the connection as needed. Most of the Microsoft .NET documentation seems geared around creating apps with datasets. Is the unbound model unnecessary for ASP.NET applications?

I am using Visual Studio #2003.
 
The SqlDataReader class delivers your records in a very fast, forward-only manner and will suite your purpose just fine due to the fact that form will be used for adding, updating and deleting records. Just make sure you close your connection and DataReader objects. A cached DataSet object makes more sense if the data being displayed is relatively static. Since the whole object of your form is for updates you would have to repopulate the cache after each addition, update or deletion if you wanted the most current data to be displayed. Therefore you would need to write just as much code. It does make sense though to use the cache for stuff like DropDownLists and ListBoxes where the data is not going to change often.
 
So a good solution would be a combination approach of caching and using a data reader.

Now for a really stupid question. What do I put into the cache? From my understanding you can put anything into the cache. I put the actual data into the cache or the actual control that contains the data? I'm assuming it's the data object(DataTable, DataReader, etc).
 
You can put antything into the cache. But as Veep says, you need to be selective. You only want to put data into cache that doesn't change, or does not change often...


Jim
 
please note one thing, a DataReader is always faster than the DataSet. I use a DataSet only when i want to use the inherent pagination methods.

anything else i use a combination of T-SQL and the DataReader...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top