|
|

<%
Const DSN = "Provider=sqloledb;Data Source=qtw9.registeredsite.com;Initial Catalog=californiacountrysidecom;User Id=user888030;Password=ay2kb43ipm"
Dim sErrorMsg
sSQLDelete = "EXEC spDeleteExpiredPackages"
Set rsDelete = Server.CreateObject("ADODB.Recordset")
rsDelete.Open sSQLDelete, DSN
sMode = LCase(Trim(Request("Mode")))
sSearchText = Trim(Request("SearchText"))
sRegionID = Trim(Request("RegionID"))
sCountyID = Trim(Request("County"))
Select Case sMode
Case "text", "county"
If ValidateForm() Then
SubmitForm()
Else
ShowForm()
End If
Case Else 'First time to page
ShowForm()
End Select
Sub ShowForm()
If sErrorMsg <> "" Then
Response.Write "" & sErrorMsg & "
"
End If
Response.Write "Looking for visitor value? We have plenty of great choices " & _
"you'll find here. Each represents a savings of at least 20%."
%>
<%
End Sub
Sub SubmitForm()
Set rs = Server.CreateObject("ADODB.Recordset")
sSQL = "EXEC spPackageSearch @RegionID = " & SQLQuotes(sRegionID) & ", " & _
"@CountyID = " & SQLQuotes(sCountyID) & ", " & _
"@SearchText = " & SQLQuotes(sSearchText)
rs.Open sSQL, DSN
Response.Write "Search Results
"
If rs.EOF Then
Response.Write "At the moment there are no special savings listed for this county, but new values are being added all the time, so do check back often.*"
Exit Sub
End If
%>
|
Offered
By
|
Package
|
Price
|
Validity
|
<%
While Not rs.EOF
sBusinessName = Trim(rs("BusinessName"))
sAddress = Trim(rs("Address"))
sAddress2 = Trim(rs("Address2"))
sCity = Trim(rs("City"))
sZIP = Trim(rs("ZIP"))
sWebsite = Trim(rs("Website"))
sAreaCode = Trim(rs("AreaCode"))
sPhone = Trim(rs("Phone"))
sPackageName = Trim(rs("PackageName"))
sDescription = Trim(rs("Description"))
sRate = Trim(rs("Rate"))
sValidityStart = Trim(rs("ValidityStart"))
sValidityEnd = Trim(rs("ValidityEnd"))
%>
<%=sBusinessName%>
<%=sAddress%>
<%=IIF(sAddress2 <> "", sAddress2 & " ", "")%>
<%=sCity%>, CA <%=sZIP%>
<%=sWebsite%>
<%="(" & sAreaCode & ") " & sPhone%> |
<%=sPackageName%>
<%=sDescription%> |
$<%=sRate%> |
From:
<%=sValidityStart%>
To: <%=sValidityEnd%> |
<%
rs.MoveNext
Wend
%>
|
<%
End Sub
Function ValidateForm()
bResult = True
If sRegionID = "" And sCountyID = "" Then
If sSearchText = "" Then
sErrorMsg = "You must enter a value to search by."
bResult = False
End If
End If
ValidateForm = bResult
End Function
Function SQLQuotes(sData)
'Remove apostrophes to prepare for insertion to SQL
'Example usage: newstring = SQLQuotes("Mike's SQL string")
If IsNull(sData) or sData = "" or len(sData)=0 or VarType(sData) = 0 Then
SQLQuotes = "NULL"
Else
SQLQuotes = "'" & Replace(sData,"'","''") & "'"
End If
End Function
Function IIF(condition,valuetrue,valuefalse)
'Author: Eric Koske Date: 07/19/1999
'Date Modified:
'If/Then logic wrapped up into a function for convenience's sake.
'Example usage: A = IIF(B=C,"Yes, they're equal","No, they're not equal")
If condition then
IIF = valuetrue
Else
IIF = valuefalse
End IF
End Function
%> |
|