%@ Language = VBScript %>
<%Option Explicit%>
<%Response.Buffer = False%>
Learn About Land - News Articles
<%
Session.Abandon()
Session.Contents.RemoveAll()
Session("selectedRecord")= ""
Session("selectedTitle")= ""
'Session("selectedRecord")= Request.QueryString("WantToRead")
dim objConnection
dim strCountyName, strArticleName, strArticle, objRS, strSelected, strSQL
dim strSiteName, strArticleLocation, strSQLArticleLocation
dim strAD, strWantToRead
strCountyName = Request.Form("CountyName")
strArticleName = Request.Form("ArticleName")
strArticle = Request.Form("Article")
strWantToRead = ""
if not IsObject("objConnection") then
set objConnection=Server.CreateObject("ADODB.Connection")
'objConnection.ConnectionTimeout = 15
' objConnection.CommandTimeout = 10
' objConnection.Mode = 3
'objConnectionOpen = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("database/articlesDB.mdb") & ";"
'adModeReadWrite
if objConnection.state = 0 then
objConnection.Open = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/database/articlesDB.mdb") & ";"
end if
end if
sub FillCountyName()
if not isObject("objRS") then
set objRS=Server.CreateObject("ADODB.RecordSet")
end if
if objRS.state <> 0 then
objRS.close
end if
strSQL = "SELECT distinct CountyName FROM ArticlesTbl ORDER BY CountyName"
objRS.Open strSQL,objConnection
'Response.Write("" & VBCRLF )
do while not objRS.EOF
if objRS("CountyName") = strCountyName then
strSelected = " Selected "
'strSelected = strCountyName
else
strSelected = ""
end if
Response.Write("" & VBCRLF )
objRS.MoveNext
loop
objRS.Close
set objRS=Nothing
end sub
sub FillArticleName()
if strCountyName <> "" then
if not isObject("objRS") then
set objRS=Server.CreateObject("ADODB.RecordSet")
end if
if objRS.state <> 0 then
objRS.close
end if
strSQL ="SELECT ArticleName, ArticleDate FROM ArticlesTbl WHERE CountyName='"& strCountyName &"' Order by ArticleDate DESC"
objRS.Open strSQL,objConnection
if objRS.eof then
Response.Write("")
else
'Response.Write("" & VBCRLF )
do while not objRS.EOF
if objRS("ArticleName") = strArticleName then
strSelected = " Selected "
'strSelected = strArticleName
else
strSelected = ""
end if
Response.Write("" & VBCRLF )
objRS.MoveNext
loop
end if
objRS.Close
set objRS=Nothing
else
Response.Write("")
end if
end sub
Sub FillArticle()
'if strCountyName <> "Select a County Name First" AND _
'strArticleName <> "Select Article Name Now" AND strArticleName <>"" then
if not isObject("objRS") then
set objRS=Server.CreateObject("ADODB.RecordSet")
end if
if objRS.state <> 0 then
objRS.close
end if
strSQL = "SELECT ArticleLocation FROM ArticlesTbl WHERE CountyName='"& strCountyName &"' AND ArticleName='" & strArticleName & "'"
objRS.Open strSQL,objConnection
if objRS.eof then
'Response.Write("")
else
'Response.Write("" & VBCRLF )
do while not objRS.EOF
if objRS("ArticleLocation") = strArticle then
strSelected = " Selected "
'strSelected = strArticle
else
strSelected = ""
end if
Session("selectedRecord") = objRS("ArticleLocation")
' Response.Write("" & VBCRLF )
objRS.MoveNext
loop
end if
objRS.Close
set objRS=Nothing
'else
'Response.Write("")
'end if
end sub
sub GetLatestArticle()
if not isObject("objRS") then
set objRS=Server.CreateObject("ADODB.RecordSet")
end if
if objRS.state <> 0 then
objRS.close
end if
'strSQL ="SELECT ArticleName, ArticleLocation FROM LatestArticle"
strWantToRead = Request.QueryString("WantToRead")
Response.Write(strWantToRead)
dim mycmp
mycmp=strcomp(strWantToRead,"",1)
if mycmp <> 0 and Session("beenRead") <> 1 then
strSQL = "SELECT TOP 1 ArticleDate, ArticleName, ArticleLocation FROM (SELECT * FROM ArticlesTbl WHERE CountyName='" &strWantToRead & "' ORDER BY ArticleDate DESC)"
Session("beenRead")=1
else
strSQL = "SELECT TOP 1 ArticleDate, ArticleName, ArticleLocation FROM (SELECT * FROM ArticlesTbl ORDER BY ArticleDate DESC)"
end if
strWantToRead=""
mycmp=0
objRS.Open strSQL,objConnection
if objRS.eof then
Response.Write("Error - No current article found")
else
Session("selectedRecord")= objRS("ArticleLocation")
Session("selectedTitle")= objRS("ArticleName")
end if
objRS.Close
set objRS=Nothing
end sub
%>
<% call getLatestArticle %>
<%
objConnection.Close
set objConnection = Nothing
objRS.Close
set objRS = Nothing
Session.Abandon()
Session.Contents.RemoveAll()
%>
<%
objConnection.Close
set objConnection = Nothing
objRS.Close
set objRS = Nothing
%>