Sitephoria Knowledge Base

Frequently Asked Questions about Sitephoria Hosting
It is currently Fri Mar 22, 2019 7:16 pm

All times are UTC - 6 hours [ DST ]

Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
PostPosted: Wed Jan 22, 2003 4:10 pm 
Site Admin

Joined: Tue Mar 05, 2002 4:22 am
Posts: 107
Microsoft's MSDN web site has a large amount of useful information on ASP. Start here: ... sptips.asp

In general, you should:

1. Use MS-SQL or MySQL as a database instead of Access if your site may have more than 10 visitors at a time. Access was not created for high traffic sites.

2. Use Access2000 or higher if you must use Access.

3. Use the OLEDB connection string instead of ODBC:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=

instead of:

DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=

4. Make sure all fields in your database that are used in a SQL WHERE clause or ORDER clause are indexed.

For example, in this statement:

SELECT [FirstName],[LastName] FROM [users] WHERE [ID]=20 AND [FirstName]='Bill' ORDER BY [LastName]

ID, FirstName, and LastName should all be indexed.

5. In your ASP pages, you should only create one connection object per ASP page. Reuse this object if you are doing multiple queries on the page.

6. Remember to close and set to nothing any database connections and recordsets that you create. This reduces the amount of memory your application uses. For example:

' Open Connection
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open getConnString()

' Open RecordSet
Set rsName = Server.CreateObject("ADODB.Recordset")
rsName.Open "SELECT * FROM config", objConn, 0, 1

' Close and Delete RecordSet
Set rsName = Nothing

' Close and Delete Connection
Set objConn = Nothing

7. When performing Read-Only queries, use adOpenForwardOnly and adLockReadOnly when creating the recordset.

For Example:

Const adOpenForwardOnly = 0
Const adLockReadOnly = 1
rsName.Open "SELECT * FROM config", objConn, adOpenForwardOnly, adLockReadOnly

This is the fastest and most efficient way to query a database.

8. Try not to use "SELECT * FROM..." queries if you do not need all the fields in the record. This selects all the fields and wastes memory. Use "SELECT [field1],[field3] FROM..." instead.

Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 6 hours [ DST ]

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group