Server time outs with sql asp query

Richard Sensale ( (no email) )
Thu, 18 Dec 1997 15:15:26 -0500

I hope someone can help me with this. Im desighning a query to use on an ASP
page we are designing to seperate a particular region of our users into a
report online. I think I have this down right but I am not all that good
with scripting these. Could you folks please take a look at it and let me
know if you see any glaring mistakes. whenever I run it I get a server time
out running the script.

<% StartDate = Request("StartDate")

EndDate = Request("EndDate") %>
<% IF (StartDate <> "") AND (EndDate <> "") THEN

Session.Timeout = 1

IF IsObject(Session("EmeraldDSN_conn")) THEN

Set conn = Session("EmeraldDSN_conn")

ELSE

Set conn = Server.CreateObject("ADODB.Connection")

conn.open "DSN=EmeraldDSN; UID=Anonymous_WWW; PWD=anonweb4220"

Set Session("EmeraldDSN_conn") = conn

END IF

sql = "SELECT CustomerID, FirstName, LastName, Region, ReferredBy,
StartDate"

sql = sql & " FROM MasterAccounts WHERE "

sql = sql & "(StartDate >= CONVERT(datetime, '" & StartDate & "')) AND "

sql = sql & "(StartDate <= CONVERT(datetime, '" & EndDate & "')) AND "

sql = sql & "(Region = 'SEV') AND "

sql = "SELECT Login, AccountType"

sql = sql & " FROM SubAccounts WHERE "

sql = sql & "(AccountType = 'SEV-Residential')"

Set rs = Server.CreateObject("ADODB.Recordset")

rs.Open sql, conn, 3, 3

On Error Resume Next

END IF %>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
SEV User Report Residential

<% IF(StartDate = "") OR (EndDate = "") THEN %>SEV ResidentialUser Report

Starting Date:(mm/dd/yy)
Ending Date:(mm/dd/yy)

 

<% ELSE %>

UserReport For Period ( <% = StartDate%> through <% = EndDate%>)

Newusers will have NEW in the Referred by column

Allothers are existing SEV users.

<% On Error Resume Next rs.MoveFirst do while not rs.EOF %>
<% rs.MoveNext loop %>
First Name Last Name Region Referred By Signup Date/Time LoginID
<% = rs.Fields("FirstName").Value%> <% = rs.Fields("LastName").Value %> <% = rs.Fields("Region").Value%> <% = rs.Fields("ReferredBy").Value%> <% = rs.Fields("StartDate").Value%> <% = rs.Fields("Login").Value%>

<% END IF %>