|
|
<%
Const DSN = "Provider=sqloledb;Data Source=qtw9.registeredsite.com;Initial Catalog=californiacountrysidecom;User Id=user888030;Password=ay2kb43ipm"
Dim sErrorMsg
sMode = LCase(Trim(Request("Mode")))
sSearchMode = LCase(Trim(Request("SearchMode")))
sMonth = Trim(Request("Month"))
sYear = Trim(Request("Year"))
sSearchText = Trim(Request("SearchText"))
'for each zub in request.form
'response.write zub & ": " & request(zub) & " "
'next
Select Case sMode
Case "submit"
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
%>
Search For Events
<%
End Sub
Sub SubmitForm()
%>
Calendar
Results
<%
sNoRecords = True
For Each zub In Request.Form
If Request(zub) = "on" Then
sEventType = Right(zub, Len(zub) - 9)
Set rs = Server.CreateObject("ADODB.recordset")
sSQL = "EXEC spEventSearch @EventType = " & (sEventType) & ", " & _
"@Month = " & SQLQuotes(sMonth) & ", " & _
"@Year = " & SQLQuotes(sYear) & ", " & _
"@SearchText = " & SQLQuotes(sSearchText)
rs.Open sSQL, DSN
If Not rs.EOF Then
sNoRecords = False
While Not rs.EOF
sTypeDescription = Trim(rs("TypeDescription"))
sEventName = Trim(rs("EventName"))
sDescription = Trim(rs("Description"))
sStartDate = Trim(rs("StartDate"))
sEndDate = Trim(rs("EndDate"))
sTimes = Trim(rs("Times"))
sAddress = Trim(rs("Address"))
sCity = Trim(rs("City"))
sZIP = Trim(rs("ZIP"))
sCounty = Trim(rs("County"))
sAreaCode = Trim(rs("AreaCode"))
sPhone = Trim(rs("Phone"))
sEmail = Trim(rs("Email"))
sWebsite = Trim(rs("Website"))
%>
| Event
Name: |
.<%=sEventName%> |
| Dates:
|
From:
<%=sStartDate%> To: <%=sEndDate%> |
| Times:
(if applicable) |
<%=sTimes%> |
| Event
Type: |
<%=sTypeDescription%> |
|
Description: |
<%=sDescription%> |
|
Address: |
<%=sAddress%>, <%=sCity%>,
CA <%=sZIP%> |
|
County: |
<%=sCounty%> |
|
Telephone: |
<%="(" & sAreaCode & ") " & sPhone%>
|
| Website: |
target=blank><%=sWebsite%> |
Email: |
<%=sEmail%> |
<%
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
End If
End If
Next
If Not sNoRecords Then
Exit Sub
End If
Set rs = Server.CreateObject("ADODB.Recordset")
sSQL = "EXEC spEventSearch @Month = " & SQLQuotes(sMonth) & ", " & _
"@Year = " & SQLQuotes(sYear) & ", " & _
"@SearchText = " & SQLQuotes(sSearchText)
'Response.Write sSQL
'Response.End
rs.Open sSQL, DSN
If rs.EOF Then
If sNoRecords Then
Response.Write "No results found."
End If
Else
While Not rs.EOF
sTypeDescription = Trim(rs("TypeDescription"))
sEventName = Trim(rs("EventName"))
sDescription = Trim(rs("Description"))
sStartDate = Trim(rs("StartDate"))
sEndDate = Trim(rs("EndDate"))
sTimes = Trim(rs("Times"))
sAddress = Trim(rs("Address"))
sCity = Trim(rs("City"))
sZIP = Trim(rs("ZIP"))
sCounty = Trim(rs("County"))
sPhone = Trim(rs("Phone"))
sEmail = Trim(rs("Email"))
sWebsite = Trim(rs("Website"))
%>
|
Event Name: |
<%=sEventName%> |
| Start
Date: |
<%=sStartDate%> |
End
Date: |
<%=sEndDate%> |
| Times:(if
applicable) |
<%=sTimes%> |
| Event
Type: |
<%=sTypeDescription%> |
|
Description: |
<%=sDescription%> |
|
Address: |
<%=sAddress%>, <%=sCity%>,
CA <%=sZIP%> |
|
County: |
<%=sCounty%> |
|
Telephone: |
<%=sPhone%> |
| Website:
|
target=blank><%=sWebsite%> |
Email:
|
<%=sEmail%> |
<%
rs.MoveNext
Wend
End If
End Sub
Function ValidateForm()
bResult = True
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
%>
|
<%
If sMode = "submit" Then
%>
|
|
<%
End If
%>
|