473,405 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

ASP code too slow on SQL Server 2005

Hi,

I have a problem with my ASP code. My code for a drop down box (which populates from a database table from MS SQL Server 2005) is running dead slow. Can anyone please guide what could be the problem. The same code when run with Access database runs faster & the dropdown populates within 20 secs, but on SQL Server 2005 it takes atleast 5 mins to populate.

Expand|Select|Wrap|Line Numbers
  1.  <% sqlgov = "SELECT DISTINCT DISTRICT_E FROM tbl_SubDist ORDER BY DISTRICT_E;"
  2.             Set rs2 = dbConn.Execute(sqlgov)
  3.             if not rs2.eof then
  4.                 rs2.movefirst
  5.                 do while not rs2.eof
  6.                 if not rs2("DISTRICT_E")="" then
  7.                 %>
  8.                   <optgroup label="<%=rs2("DISTRICT_E")%>">
  9.  
  10.                     <%
  11.             sql = "SELECT DISTINCT Subdist_E FROM tbl_SubDist where DISTRICT_E = '"&rs2("DISTRICT_E")&"' ORDER BY Subdist_E;"
  12.             Set rs = dbConn.Execute(sql)
  13.             if not rs.eof then
  14.                 rs.movefirst
  15.                 do while not rs.eof
  16.                     if not rs("Subdist_E")="" then
  17.             %>
  18.                 <option value="<%response.Write(rs("Subdist_E"))%>">
  19.                   <%response.Write(rs("Subdist_E"))%>
  20.                 </option>
  21.                 <%
  22.                     end if
  23.                 rs.movenext
  24.                 loop
  25.                 rs.close
  26.             end if
  27.             %></optgroup>
  28.                   <%end if
  29.                 rs2.movenext
  30.                 loop
  31.                 rs2.close
  32.             end if%>
  33.                 </select>
In my DB table, I have 109 districts & 280 sub distrcits ( for the 109 districts). I am really bogged down here & frustrated, since the code on Access db returns values in flash. I have a very limited knowledge of SQL Server 2005 & have to run the code on it.Thank you for helping me out.
Nov 29 '09 #1
2 2532
AricC
1,892 Expert 1GB
How long does it take to return those queries in the SQL Server 05 Management Studio? Is the server the SQL is on getting hammered? 20 secs is to long to populate a list box. With 200 rows it should populate in less than 2 secs.
Dec 10 '09 #2
Thanks AricC, I've figured out the problem, actually I was using the wrong cursors & that caused a delay to populate my listboxes. Thanks again.
Dec 11 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Neil | last post by:
I've been discussing here a SQL 7 view which scrolls slowly when linked to an Access 2000 MDB. After trying various things, I've distilled it down to the following: when the linked view has a...
0
by: schmurgon | last post by:
Debugging my 1.1 framework ASP.NET web application (which talks to a ..NET Web Service on the same machine) has become extremely slow since installing VS 2005 and / or SQL Server 2005. It takes...
53
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code,...
11
by: HC | last post by:
I posted this in one of the VB forums but I'm starting to think it might be more appropriate to have it here, since it really seems to be a SQL server (MSDE/Express 2005) problem: Hey, all, I...
0
by: Pratchaya | last post by:
In my.cnf i add these lines ####### log-bin log-slow-queries = /var/log/mysqld-slow.log long_query_time=1 #######
2
by: mezise | last post by:
Posted by Pratchaya: ------------------------------------------------------ MySQL Slow Log ERROR In my.cnf i add these lines ####### log-bin log-slow-queries = /var/log/mysqld-slow.log
3
by: pramodbura | last post by:
We have a quick query regarding SQL performance. We have SQL Server 2000 (32 Bit) and SQL Server 2005 (64 Bit) as two separate instances on a DB Server. We were analysing the execution times for...
1
by: GatorDBA | last post by:
Hey Folks, Experiencing strange problem with SQL 2005 running on Windows Server 2008. When trying to connect via named pipes or tcp, it takes 25-45 seconds for the connection to be established....
12
by: Marc Baker | last post by:
Bear with me here folks, I don't know much MS SQL performance. Wondering if someone can point me in the right direction. I have 1 particular database where queries are slow. To test this theory,...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.