Fastest way of Database Access : Caching Records in Memory
2571Fastest way of Database Access : Caching Records in Memoryhttp://www.stardeveloper.com/articles/080501-1.shtmlIn this step by step tutorial I will guide you to build the fastest method to display records from the database using plain ASP. The technique we are going to use is based on a simple fact that you don't have to hit database every time you want to display records. Take for example a list box which displays names of countries from the database. How many times you are going to change the countries in the database? I bet not often. So if you have to show those countries from the database then it will be better to cache these records in the memory and display them from memory every time you want to display that country list to the user.ASP > Tips and Tutorials > Database-relatedOct 10, 2006
The answer is shown below. All I had to do was create an object, and use "expando properties" to fill it with recordsets. The function DBGetNamedRecords takes the name of the recordset and the SQL to fill it.
The driving force behind Active Server technologies is data access. In order to develop a truly dynamic web site developers need to allow users to access data on demand. Luckily, with Microsoft's Active Server Pages, this is exceedingly easy to do. This article for ASP beginners details how to connect to a SQL Server 7.0 database using ActiveX Data Object (ADO) and Open Database Connectivity (ODBC).
Now everybody can connect to a database. Simple database access is a huge feature of ASP and one of the most widely used by developers but when you are first learning, it's hard to separate the database stuff from the rest of the code so I made this example
The power of Active Server Pages comes through when we tie databases to our web sites. To connect to a database, ASP uses what is called ActiveX Data Objects, or ADO for short. ADO comes with ASP, and can be used easily from your ASP pages.
In this tutorial we will show you how to connect to our Access database called 'examples.mdb' and retrieve all the records from the table 'cars'.
At first we must create an instance of the connection object and feed it the location of the database we wish to connect to and the driver that we intend to use. For these purposes we will use a connection string. You can choose an ODBC or an OLEDB connection string. We will use OLEDB for our example as it's faster and more stable. Next, we should open the connection to the database:
Joining mailing list will entitle you
to receive occasional emails informing you of news and
updates to the site and any special offers that may be
of interest to you.