Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Storing Data in Application State
Message
From
15/05/2005 02:26:51
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Storing Data in Application State
Environment versions
Environment:
C# 1.1
OS:
Windows 2000 SP4
Database:
MS SQL Server
Miscellaneous
Thread ID:
01014327
Message ID:
01014327
Views:
51
VS .Net 2003. ASP.NET and C# newbie.

I'm building 3 forms. On each form there will be 3 dropdown lists. The choices in these lists are all the same and unchanging. Each list will have 81 choices totalling roughly 5K of data.

At the moment the list choices are stored in a SQL Server view, with 2 columns: a primary key value (int), and a text description (varchar).

Rather than hitting the backend DB repeatedly, it looks to me like it would be a good idea to store as much of this information as possible in (global) Application State, where any Form in any Session would be able to make use of it i.e. load once, use often.

Each dropdown will be bound to a backend SQL column e.g. DL1 to DL9. The value stored is the pkey, what is to be displayed is the text description (normal dropdown list stuff). Can anyone suggest a good strategy to minimize server resource use? So far I've thought of 2 potential schemes:

Store an Array:
- Create a SqlDataReader on the view
- Spin through the view, adding rows to a string[,] Choices array (downside - would need to cast the int pkeys to strings, then restore later?)
- Application["arChoices"] = Choices
- Is it simple & efficient to populate the dropdown list choices from this array?

Store a DataTable:
- Is it possible to persist these in Application State?
- Would it be efficient/elegant to use one to help populate the dropdown lists?

Any comments on the above, or completely different ideas, welcomed.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Next
Reply
Map
View

Click here to load this message in the networking platform