kreplech
May 8th, 2001, 10:39 AM
I am fairly new to this and I would love some criticism (constructive, of course) regarding the code below...
option Explicit
private objConn as ADODB.Connection
private objCmd as ADODB.Command
private objRs as ADODB.Recordset
public Sub OnStartPage(byref rScriptingcontext as ScriptingContext)
set gAspAppl = rScriptingcontext.Application
set gAspReq = rScriptingcontext.Request
set gAspResp = rScriptingcontext.Response
set gAspServer = rScriptingcontext.Server
set gAspSession = rScriptingcontext.Session
End Sub
public Sub OnEndPage()
set gAspAppl = nothing
set gAspReq = nothing
set gAspResp = nothing
set gAspServer = nothing
set gAspSession = nothing
End Sub
public Sub propertyFinder(SQL, database)
Dim style as string, cityCounty as string, city as string, county as string, zipCode as string, bed as string, bath as string, anyprice as string, min, max as string
Dim pool as string, water as string, garage as string, security as string, adult as string, acreage as string
Dim strConn as string, sqlString as string
Dim count as Integer
set objConn = new ADODB.Connection
set objCmd = new ADODB.Command
set objRs = new ADODB.Recordset
strConn = database
sqlString = SQL
With objConn
.ConnectionTimeout = 30
.CommandTimeout = 30
.Open (database)
End With
style = gAspReq.Form("style")
cityCounty = gAspReq.Form("cityCounty")
city = gAspReq.Form("city")
county = gAspReq.Form("county")
zipCode = gAspReq.Form("zipCode")
bed = gAspReq.Form("bed")
bath = gAspReq.Form("bath")
anyprice = gAspReq.Form("anyprice")
min = gAspReq.Form("min")
max = gAspReq.Form("max")
pool = gAspReq.Form("pool")
water = gAspReq.Form("water")
garage = gAspReq.Form("garage")
security = gAspReq.Form("security")
adult = gAspReq.Form("adult")
acreage = gAspReq.Form("acreage")
objRs.Open sqlString, objConn, adOpenDynamic
With gAspResp
Do While Not objRs.EOF
count = count + 1
.Write "
<p>" & count & ".<strong> property Type:</strong> " & objRs(2)
.Write " <strong>Listing date:</strong> " & objRs(3)
.Write " <strong>Address:</strong> " & objRs(5) & " " & objRs(6) & " " & objRs(7) & " " & objRs(8)
.Write " <strong>Spec ID:</strong> " & objRs("T28PropertySpecsID") & "</p>"
objRs.MoveNext
Loop
End With
If (count = 0) then
gAspResp.Write "Your search returned <strong>0</strong> results."
End If
gAspResp.Write "<p>" & sqlString & "</p>"
objRs.Close
set objRs.ActiveConnection = nothing
End Sub
Web Dev
Boca Raton, FL
kreplech@aol.com
option Explicit
private objConn as ADODB.Connection
private objCmd as ADODB.Command
private objRs as ADODB.Recordset
public Sub OnStartPage(byref rScriptingcontext as ScriptingContext)
set gAspAppl = rScriptingcontext.Application
set gAspReq = rScriptingcontext.Request
set gAspResp = rScriptingcontext.Response
set gAspServer = rScriptingcontext.Server
set gAspSession = rScriptingcontext.Session
End Sub
public Sub OnEndPage()
set gAspAppl = nothing
set gAspReq = nothing
set gAspResp = nothing
set gAspServer = nothing
set gAspSession = nothing
End Sub
public Sub propertyFinder(SQL, database)
Dim style as string, cityCounty as string, city as string, county as string, zipCode as string, bed as string, bath as string, anyprice as string, min, max as string
Dim pool as string, water as string, garage as string, security as string, adult as string, acreage as string
Dim strConn as string, sqlString as string
Dim count as Integer
set objConn = new ADODB.Connection
set objCmd = new ADODB.Command
set objRs = new ADODB.Recordset
strConn = database
sqlString = SQL
With objConn
.ConnectionTimeout = 30
.CommandTimeout = 30
.Open (database)
End With
style = gAspReq.Form("style")
cityCounty = gAspReq.Form("cityCounty")
city = gAspReq.Form("city")
county = gAspReq.Form("county")
zipCode = gAspReq.Form("zipCode")
bed = gAspReq.Form("bed")
bath = gAspReq.Form("bath")
anyprice = gAspReq.Form("anyprice")
min = gAspReq.Form("min")
max = gAspReq.Form("max")
pool = gAspReq.Form("pool")
water = gAspReq.Form("water")
garage = gAspReq.Form("garage")
security = gAspReq.Form("security")
adult = gAspReq.Form("adult")
acreage = gAspReq.Form("acreage")
objRs.Open sqlString, objConn, adOpenDynamic
With gAspResp
Do While Not objRs.EOF
count = count + 1
.Write "
<p>" & count & ".<strong> property Type:</strong> " & objRs(2)
.Write " <strong>Listing date:</strong> " & objRs(3)
.Write " <strong>Address:</strong> " & objRs(5) & " " & objRs(6) & " " & objRs(7) & " " & objRs(8)
.Write " <strong>Spec ID:</strong> " & objRs("T28PropertySpecsID") & "</p>"
objRs.MoveNext
Loop
End With
If (count = 0) then
gAspResp.Write "Your search returned <strong>0</strong> results."
End If
gAspResp.Write "<p>" & sqlString & "</p>"
objRs.Close
set objRs.ActiveConnection = nothing
End Sub
Web Dev
Boca Raton, FL
kreplech@aol.com