I have a form that auto-completes from a database containing 2000+ and growing names. This works fine, but there’s an annoying lag between when the user types and when the list is returned. I want to store the data temporarily during the lifetime of the page to speed things up.
Using static variables seems to work, but I’m scared of the auto-complete variable becoming out of date. Is there something else I could use?
You can use the
Caching.Cacheclass to hold the values – when you insert to the cache, you can set the item to expire using aTimeSpan, or depending on the version of SQL Server, you could useSqlDependencydirectly with it to track changes in the DB.