Website slow when accessing DB - HELP!!

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Website slow when accessing DB - HELP!!

    Hi

    I have a webpage which if a certain criteria is met, will lookup
    information from an access database.

    The page loads quickly if the database isn't queried, however if the
    page 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?

    Any comments greatly appreciated!!
    Sprout Guest

  2. Similar Questions and Discussions

    1. Slow performance of website
      Hi, I'm not really much of a techie, but I'm having problems with my intranet server, its on a windows 2000 machine with service pack 4, with...
    2. Slow Website
      I recently created my website in Publisher 2003. When I go to the website the pictures load extremely slow and eventually crashes IE. We set up a...
    3. ASP paes accessing SQL database run very slow
      ASP pages that query SQL database (not on the IIS box) run slower as time passes but once the IIS is restarted they start running faster. any...
    4. Website running slow?
      Hey, I don't know if it's the area I live in or what, but my site http://www.volconvo.com seems to load slow for me. Anyone know a good...
    5. Slow loading DW Mx website
      I just switched over to DW MX (from frontpage-no jokes please) and have a major problem with a DW website. Since I'm very short on time I attempted...
  3. #2

    Default Re: Website slow when accessing DB - HELP!!

    I don't see anything inherently wrong anywhere, like any endless loops or
    anything. I can offer a different version of the code to make things a
    little more efficient, but nothing that ~should~ make it go from timing out
    to being an instantaneous page or anything. Here is an alternate version.
    Look at what is different, and if you'd like to know why anything was
    changed, post back.


    <%
    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

    SQL = "SELECT [col1],[col2],[col3],[col4],[col5],[col6] "
    SQL = SQL & "FROM table1 "
    SQL = SQL & "WHERE name = '" & name & "'"

    %>
    <%
    ' THIS SECTION IS NORMALLY IN AN INCLUDE
    Set Conn = Server.CreateObject("ADODB.Connection")
    conString = " Provider=Microsoft.Jet.OLEDB.4.0;Data
    Source=D:\w\o\womble\private\"
    conString = conString & dbname
    %>
    <%

    set rs=Conn.execute(SQL)

    var1 = rs.fields.item(0).value
    var2 = rs.fields.item(1).value
    var3 = rs.fields.item(2).value
    var4 = rs.fields.item(3).value
    var5 = rs.fields.item(4).value
    var6 = rs.fields.item(5).value
    %>
    <%
    ' THIS SECTION IS NORMALLY IN AN INCLUDE
    rs.close
    set rs=nothing
    Conn.close
    set Conn=nothing

    End If
    %>



    Ray at home



    "Sprout" <rinkydinky@btconnect.com> wrote in message
    news:1n5nqvkv4jbd2iprvq9lfbrkgku7tj4c48@4ax.com...
    > Hi
    >
    > I have a webpage which if a certain criteria is met, will lookup
    > information from an access database.
    >
    > The page loads quickly if the database isn't queried, however if the
    > page 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?
    >
    > Any comments greatly appreciated!!

    Ray at Guest

  4. #3

    Default Re: Website slow when accessing DB - HELP!!

    Sprout wrote:
    > Hi
    >
    > I have a webpage which if a certain criteria is met, will lookup
    > information from an access database.
    >
    > The page loads quickly if the database isn't queried, however if the
    > page 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.
    Does the page have the data from the database when it loads after timing
    out?
    >
    > Here is the code that acceses the database (it's been modified
    > slightly with different variable names etc)....
    >
    <snip>
    > At the moment, the database only contains two records.
    >
    > Have I done something wrong here which will cause performance
    > problems?
    >
    > Any comments greatly appreciated!!
    Beyond Ray's suggestion to use the native Jet OLEDB provider, the only
    suggestion I can make is to try and narrow down further where the bottleneck
    is occurring. Is it happening when the connection is opened? Is it happening
    when you run the query?

    Bob Barrows

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Barrows Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139