Forum Moderators: open
I have a webpage which if a certain criteria is met, will lookup information from an access database. The site is on a Windows 2003 server.
The page loads quickly if the database isn't queried, however if thepage looks info up from the database, the page often (but not all of the time) takes ages to load - it's as though the server needs to timeout before the page loads.
Here is the code that acceses the database (it's been modified slightly with different variable names etc)....
<%
dim dbname, var1, var2, var3, var4, var5, var6, conString
dim formvar, name
dbname = abc.mdb
formvar = Request.Form(formvar)
name = Request.Form(name)
If formvar = "" Then
var1 = "a"
var2 = "b"
var3 = "c"
var4 = "d"
var5 = "e"
var6 = "f"
Else
%>
<%
'THIS SECTION IS NORMALLY IN AN INCLUDE
Set Conn = Server.CreateObject("ADODB.Connection")
conString = "DBQ=D:\w\o\womble\private\"
conString = conString & dbname
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)};" & conString
%>
<%
SQL = "SELECT * "
SQL = SQL & "FROM table1 "
SQL = SQL & "WHERE name = '"&name&"'"
set rs=Conn.execute(SQL)
var1 = rs(1)
var2 = rs(2)
var3 = rs(3)
var4 = rs(4)
var5 = rs(5)
var6 = rs(6)
%>
<%
'THIS SECTION IS NORMALLY IN AN INCLUDE
set rs=nothing
Conn.close
set Conn=nothing
End If
%>
At the moment, the database only contains two records.
Have I done something wrong here which will cause performance problems, or should I be asking questions to the web host?
Any comments greatly appreciated!
But I don't think buffering is likely an issue if the page is simple and is just taking a long time because of data access.
However, to prove that it is the data access, you could do Response.Writes before and after the database calls, and write out the current timestamp. That will confirm that the time is spent in the DB call or not.