mikebaldwin
IS-IT--Management
Hi everyone!
I finally joined up after quite some time peeking in at all of your helpfull information!
I've got a question for you all, i get the following error on a page for a site that i inherited here at work, and i'm going nuts, and am finally able to admit defeat!! Help!!
Microsoft VBScript compilation error '800a0409'
Unterminated string constant
/globallearn/traincalendar/intl/search.asp, line 86
Execute(arrayColNames(x) & "NameArray(" & counter & ") = """ &rs.Fields(dbColumns(x)).Value& """")
here's the code:
<%
'==============================================
' VARIABLES
'==============================================
dbName = "Dates"
dbPath = "external\courses.mdb"
dbTable = "tblDates"
dbColumnMain = "dateStart"
dbTables = Array("","","","","tblCourses","tblFacilitators","tblLocs","tblCountries","tblRegions","tblLangs","tblModes","","")
dbColumns = Array("","","","","title","name","address","name","name","name","name","","")
pageName = "search.asp"
arrayColNames = Array("ID","dateStart","dateEnd","regDead","name","facilitator","loc","country","region","lang","mode","datePost","dateMod")
arrayColNamesLong = Array("ID","Start Date","End Date","Registration Deadline","Name","Facilitator","Venue","Country","Region","Language","Mode","Post Date","Modified Date")
arrayColTypes = Array("int","date","date","date","int","int","int","int","int","int","int","datePost","dateMod")
arrayColWidths = Array("25","100","100","75","425","425","425","150","150","150","150","75","75")
arrayColFormObjects = Array("none","textField","textField","textField","dropDownLink","dropDownLink","dropDownLink","dropDownLink","dropDownLink","dropDownLink","dropDownLink","none","none")
arrayColDisplay = Array(0,1,1,1,1,1,1,1,1,1,1,0,0)
arrayColRequired = Array(0,1,1,1,1,1,1,1,1,1,1,1,1)
'==============================================
' COUNT DISPLAYED COLUMNS
'==============================================
colDisplayCount = 1
for x = 0 to UBound(arrayColDisplay)
if arrayColDisplay(x) = 1 then colDisplayCount = colDisplayCount + 1
next
'==============================================
' DATABASE CONNECTION
'==============================================
set conn= Server.CreateObject("ADODB.Connection")
conn.open "provider=microsoft.jet.oledb.4.0; data source=" & Server.MapPath(dbPath)
'=====================================================================
' Load Current Selections
'=====================================================================
curCourse=request.form("curCourse")
curFacilitator=request.form("curFacilitator")
curLoc=request.form("curLoc")
curCountry=request.form("curCountry")
curRegion=request.form("curRegion")
curMode=request.form("curMode")
curLang=request.form("curLang")
curDate=request.form("curDate")
' Verify Data
if curCourse = "" then curCourse="ALL"
if curFacilitator = "" then curFacilitator="ALL"
if curLoc = "" then curLoc="ALL"
if curCountry = "" then curCountry="ALL"
if curRegion = "" then curRegion="ALL"
if curMode = "" then curMode="ALL"
if curLang = "" then curLang="ALL"
if curDate = "" then curDate="ALL"
'==============================================
' DROPDOWN DATA LOAD
'==============================================
for x = 0 to UBound(arrayColFormObjects)
if arrayColFormObjects(x) = "dropDown" then
set rs=Server.CreateObject("ADODB.recordset")
sql = "SELECT DISTINCT " & arrayColNames(x) & " FROM "&dbTable&" ORDER BY " & arrayColNames(x) & " ASC"
rs.Open sql,conn
counter = 0
Execute("Dim " & arrayColNames(x) & "Array()")
Do While Not rs.EOF
Execute("Redim PRESERVE " & arrayColNames(x) & "Array(" & counter & ")")
Execute(arrayColNames(x) & "Array(" & counter & ") = """ & rs.Fields(arrayColNames(x)).Value & """")
counter = counter + 1
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
elseif arrayColFormObjects(x) = "dropDownLink" then
set rs=Server.CreateObject("ADODB.recordset")
sql = "SELECT DISTINCT "&dbTables(x)&".ID,"&dbTables(x)&"."&dbColumns(x)&" FROM "&dbTable&","&dbTables(x)&" ORDER BY "&dbTables(x)&"."&dbColumns(x)&" ASC"
rs.Open sql,conn
counter = 0
Execute("Dim " & arrayColNames(x) & "Array()")
Execute("Dim " & arrayColNames(x) & "NameArray()")
Do While Not rs.EOF
Execute("Redim PRESERVE " & arrayColNames(x) & "Array(" & counter & ")")
Execute("Redim PRESERVE " & arrayColNames(x) & "NameArray(" & counter & ")")
Execute(arrayColNames(x) & "Array(" & counter & ") = """ & rs.Fields("ID").Value & """")
Execute(arrayColNames(x) & "NameArray(" & counter & ") = """ &rs.Fields(dbColumns(x)).Value& """")
counter = counter + 1
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
end if
next
'==============================================
' DATABASE LOAD
'==============================================
curColumn = Request.Form("curCol")
prevColumn = Request.Form("prevCol")
curSort = Request.Form("curSort")
if curColumn = "" then curColumn = dbColumnMain
if Request.Form("submit") <> "Edit" and Request.Form("submit") <> "Delete" and Request.Form("submit") <> "Cancel" then
if curSort = " DESC" or curSort = "" or prevColumn <> curColumn then
curSort = " ASC"
else
curSort = " DESC"
end if
end if
curCourseSel = ""
curFacilitatorSel = ""
curLocSel = ""
curCountrySel = ""
curRegionSel = ""
curLangSel = ""
curModeSel = ""
curDateSel = ""
if curCourse <> "ALL" then curCourseSel = " AND "&dbTable&".name = "&curCourse
if curFacilitator <> "ALL" then curFacilitatorSel = " AND "&dbTable&".facilitator = "&curFacilitator
if curLoc <> "ALL" then curLocSel = " AND "&dbTable&".loc = "&curLoc
if curCountry <> "ALL" then curCountrySel = " AND "&dbTable&".country = "&curCountry
if curRegion <> "ALL" then curRegionSel = " AND "&dbTable&".region = "&curRegion
if curLang <> "ALL" then curLangSel = " AND "&dbTable&".lang = "&curLang
if curMode <> "ALL" then curModeSel = " AND "&dbTable&".mode = "&curMode
if curDate <> "ALL" then curDateSel = " AND "&dbTable&".dateStart = #"&curDate&"#"
if curCourseSel <> "" or curFacilitatorSel <> "" or curLocSel <> "" or curCountrySel <> "" or curRegionSel <> "" or curLangSel <> "" or curModeSel <> "" or curDateSel <> "" then
sql = "SELECT * FROM "&dbTable&" WHERE "&dbTable&".name = "&dbTable&".name"&curCourseSel&curFacilitatorSel&curRegionSel&curCountrySel&curLangSel&curLocSel&curModeSel&curDateSel&" ORDER BY " & curColumn & curSort
else
sql = "SELECT * FROM "&dbTable&" ORDER BY " & curColumn & curSort
end if
sqlCourses = "SELECT DISTINCT "&dbTables(4)&".ID, "&dbTables(4)&"."&dbColumns(4)&" FROM "&dbTables(4)&", "&dbTable&" WHERE "&dbTable&".name = "&dbTables(4)&".ID"&curCourseSel&curFacilitatorSel&curRegionSel&curCountrySel&curLangSel&curLocSel&curModeSel&curDateSel&" ORDER BY "&dbTables(4)&"."&dbColumns(4)
sqlFacilitators = "SELECT DISTINCT "&dbTables(5)&".ID, "&dbTables(5)&"."&dbColumns(5)&" FROM "&dbTables(5)&", "&dbTable&" WHERE "&dbTable&".facilitator = "&dbTables(5)&".ID"&curCourseSel&curFacilitatorSel&curRegionSel&curCountrySel&curLangSel&curLocSel&curModeSel&curDateSel&" ORDER BY "&dbTables(5)&"."&dbColumns(5)
sqlLocs = "SELECT DISTINCT "&dbTables(6)&".ID, "&dbTables(6)&"."&dbColumns(6)&" FROM "&dbTables(6)&", "&dbTable&" WHERE "&dbTable&".loc = "&dbTables(6)&".ID"&curCourseSel&curFacilitatorSel&curRegionSel&curCountrySel&curLangSel&curLocSel&curModeSel&curDateSel&" ORDER BY "&dbTables(6)&"."&dbColumns(6)
sqlCountries = "SELECT DISTINCT "&dbTables(7)&".ID, "&dbTables(7)&"."&dbColumns(7)&" FROM "&dbTables(7)&", "&dbTable&" WHERE "&dbTable&".country = "&dbTables(7)&".ID"&curCourseSel&curFacilitatorSel&curRegionSel&curCountrySel&curLangSel&curLocSel&curModeSel&curDateSel&" ORDER BY "&dbTables(7)&"."&dbColumns(7)
sqlRegions = "SELECT DISTINCT "&dbTables(8)&".ID, "&dbTables(8)&"."&dbColumns(8)&" FROM "&dbTables(8)&", "&dbTable&" WHERE "&dbTable&".region = "&dbTables(8)&".ID"&curCourseSel&curFacilitatorSel&curRegionSel&curCountrySel&curLangSel&curLocSel&curModeSel&curDateSel&" ORDER BY "&dbTables(8)&"."&dbColumns(8)
sqlLangs = "SELECT DISTINCT "&dbTables(9)&".ID, "&dbTables(9)&"."&dbColumns(9)&" FROM "&dbTables(9)&", "&dbTable&" WHERE "&dbTable&".lang = "&dbTables(9)&".ID"&curCourseSel&curFacilitatorSel&curRegionSel&curCountrySel&curLangSel&curLocSel&curModeSel&curDateSel&" ORDER BY "&dbTables(9)&"."&dbColumns(9)
sqlModes = "SELECT DISTINCT "&dbTables(10)&".ID, "&dbTables(10)&"."&dbColumns(10)&" FROM "&dbTables(10)&", "&dbTable&" WHERE "&dbTable&".mode = "&dbTables(10)&".ID"&curCourseSel&curFacilitatorSel&curRegionSel&curCountrySel&curLangSel&curLocSel&curModeSel&curDateSel&" ORDER BY "&dbTables(10)&"."&dbColumns(10)
sqlDates = "SELECT DISTINCT "&dbTable&".dateStart FROM "&dbTable&" WHERE "&dbTable&".dateStart = "&dbTable&".dateStart"&curCourseSel&curFacilitatorSel&curRegionSel&curCountrySel&curLangSel&curLocSel&curModeSel&curDateSel&" ORDER BY "&dbTable&".dateStart"
'==============================================
' OPEN RECORDS
'==============================================
set rs=Server.CreateObject("ADODB.recordset")
set rsCourses=Server.CreateObject("ADODB.recordset")
set rsFacilitators=Server.CreateObject("ADODB.recordset")
set rsLocs=Server.CreateObject("ADODB.recordset")
set rsCountries=Server.CreateObject("ADODB.recordset")
set rsRegions=Server.CreateObject("ADODB.recordset")
set rsLangs=Server.CreateObject("ADODB.recordset")
set rsModes=Server.CreateObject("ADODB.recordset")
set rsDates=Server.CreateObject("ADODB.recordset")
rs.Open sql,conn
rsCourses.Open sqlCourses, conn
rsFacilitators.Open sqlFacilitators, conn
rsLocs.Open sqlLocs, conn
rsCountries.Open sqlCountries, conn
rsRegions.Open sqlRegions, conn
rsLangs.Open sqlLangs, conn
rsModes.Open sqlModes, conn
rsDates.Open sqlDates, conn
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Wyndham Global Learning | Training Calendar</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
function submitform(curCol) {
document.sortForm.curCol.value = curCol
document.sortForm.submit();
}
</script>
<style>
<!--
/*-- MAIN -------------------------------------------------------------------*/
HTML, body, table {
font-family: Arial, Verdana, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
color: #000000;
background-color: #FFFFFF;
}
/*-- TABLE TITLE & HEADER ---------------------------------------------------*/
.title {
font-size: 14px;
font-weight: bold;
color: #FFFFFF;
background-color: #93AFD7;
}
.header {
font-weight: bold;
color: #5F6062;
background-color: #DFE5F3;
}
.headerSide {
color: #5F6062;
background-color: #F4F4F4;
}
.footer {
background-color: #DFE5F3;
}
/*-- TABLE CONTENTS ---------------------------------------------------------*/
.content {
font-size: 12px;
background-color: #FFFFFF;
}
.contentEdit {
font-size: 12px;
background-color: #F9FCC2;
}
.contentDelete {
font-size: 12px;
background-color: #FFCCCC;
}
/*-- TABLE SELECTED ------------------------------------------------*/
.header .sel {
color: #FFFFFF;
background-color: #1D74BA;
}
.content .sel {
background-color: #F4F4F4;
}
.contentEdit .sel {
background-color: #F3F984;
}
.contentDelete .sel {
background-color: #FFA4A4;
}
/*-- LINKS ------------------------------------------------------------------*/
a:link, visited {
font-size: 11px;
font-weight: bold;
color: #1D74BA;
text-decoration: none;
}
a:link .sel, visited .sel {
font-size: 11px;
font-weight: bold;
color: #FFFFFF;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:hover.sel {
text-decoration: underline;
}
/*-- FORM ELEMENTS ---------------------------------------------------------*/
input, textarea, select {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: normal;
}
.button {
font-size: 10px;
width: 50;
}
/*-- NOTES ----------------------------------------------------------------*/
.note {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #FFFFFF;
background-color: #C8D30C;
}
.warn {
color: #FFFFFF;
background-color: #990000;
}
.success {
color: #FFFFFF;
background-color: #006600;
}
-->
</style>
<%
'==============================================
' STYLE WIDTHS FOR FORM ELEMENTS
'==============================================
response.write("<style>" & vbcrlf)
response.write("<!--" & vbcrlf)
for x = 0 to UBound(arrayColWidths)
response.write(".form"&arrayColWidths(x)&" {width: "&arrayColWidths(x)&";}" & vbcrlf)
next
response.write("-->" & vbcrlf)
response.write("</style>" & vbcrlf)
%>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!--#include file="navMain.asp"-->
<table width="100%" border="0" cellspacing="20" cellpadding="0">
<tr>
<td>
<table border="1" cellspacing="3" cellpadding="5" bordercolor="#CCCCCC">
<tr>
<td colspan="4" class="title">Search</td>
</tr>
<form name="search" method="post" action="<%= pageName %>">
<tr>
<td align="right" valign="top" class="headerSide">Course:</td>
<td colspan="3" align="left" valign="top" class="content"><select name="curCourse" class="form<%= arrayColWidths(4) %>" onChange="document.search.submit()">
<%
response.write("<option value=ALL>ALL</option>")
do until rsCourses.EOF
response.write("<option value=" & rsCourses.fields("ID"))
if CStr(rsCourses.fields("ID")) = curCourse then
response.write(" selected")
end if
response.write(">")
response.write(rsCourses.fields("title"))
response.write("</option>")
rsCourses.MoveNext
loop
rsCourses.Close
set rsCourses = Nothing
%>
</select></td>
</tr>
<tr>
<td align="right" valign="top" class="headerSide">Facilitator:</td>
<td colspan="3" align="left" valign="top" class="content"><select name="curFacilitator" class="form<%= arrayColWidths(5) %>" onChange="document.search.submit()">
<%
response.write("<option value=ALL>ALL</option>")
do until rsFacilitators.EOF
response.write("<option value=" & rsFacilitators.fields("ID"))
if CStr(rsFacilitators.fields("ID")) = curFacilitator then
response.write(" selected")
end if
response.write(">")
response.write(rsFacilitators.fields("name"))
response.write("</option>")
rsFacilitators.MoveNext
loop
rsFacilitators.Close
set rsFacilitators = Nothing
%>
</select></td>
</tr>
<tr>
<td align="right" valign="top" class="headerSide">Venue: </td>
<td colspan="3" align="left" valign="top" class="content"><select name="curLoc" class="form<%= arrayColWidths(6) %>" onChange="document.search.submit()">
<%
response.write("<option value='ALL'>ALL</option>")
do until rsLocs.EOF
response.write("<option value=" & rsLocs.fields("ID"))
if CStr(rsLocs.fields("ID")) = curLoc then
response.write(" selected")
end if
response.write(">")
response.write(rsLocs.fields("address"))
response.write("</option>")
rsLocs.MoveNext
loop
rsLocs.Close
set rsLocs = Nothing
%>
</select></td>
</tr>
<tr>
<td align="right" valign="top" class="headerSide">Country:</td>
<td align="left" valign="top" class="content"><select name="curCountry" class="form<%= arrayColWidths(7) %>" onChange="document.search.submit()">
<%
response.write("<option value='ALL'>ALL</option>")
do until rsCountries.EOF
response.write("<option value=" & rsCountries.fields("ID"))
if CStr(rsCountries.fields("ID")) = curCountry then
response.write(" selected")
end if
response.write(">")
response.write(rsCountries.fields("name"))
response.write("</option>")
rsCountries.MoveNext
loop
rsCountries.Close
set rsCountries = Nothing
%>
</select></td>
<td align="right" valign="top" class="headerSide">Language:</td>
<td align="left" valign="top" class="content"><select name="curLang" class="form<%= arrayColWidths(9) %>" onChange="document.search.submit()">
<%
response.write("<option value='ALL'>ALL</option>")
do until rsLangs.EOF
response.write("<option value=" & rsLangs.fields("ID"))
if CStr(rsLangs.fields("ID")) = curLang then
response.write(" selected")
end if
response.write(">")
response.write(rsLangs.fields("name"))
response.write("</option>")
rsLangs.MoveNext
loop
rsLangs.Close
set rsLangs = Nothing
%>
</select></td>
</tr>
<tr>
<td align="right" valign="top" class="headerSide">Region:</td>
<td align="left" valign="top" class="content"><select name="curRegion" class="form<%= arrayColWidths(8) %>" onChange="document.search.submit()">
<%
response.write("<option value='ALL'>ALL</option>")
do until rsRegions.EOF
response.write("<option value=" & rsRegions.fields("ID"))
if CStr(rsRegions.fields("ID")) = curRegion then
response.write(" selected")
end if
response.write(">")
response.write(rsRegions.fields("name"))
response.write("</option>")
rsRegions.MoveNext
loop
rsRegions.Close
set rsRegions = Nothing
%>
</select></td>
<td align="right" valign="top" class="headerSide">Delivery Mode:</td>
<td align="left" valign="top" class="content"><select name="curMode" class="form<%= arrayColWidths(10) %>" onChange="document.search.submit()">
<%
response.write("<option value='ALL'>ALL</option>")
do until rsModes.EOF
response.write("<option value=" & rsModes.fields("ID"))
if CStr(rsModes.fields("ID")) = curMode then
response.write(" selected")
end if
response.write(">")
response.write(rsModes.fields("name"))
response.write("</option>")
rsModes.MoveNext
loop
rsModes.Close
set rsModes = Nothing
%>
</select></td>
</tr>
<tr>
<td align="right" valign="top" class="headerSide">Start Dates: </td>
<td colspan="3" align="left" valign="top" class="content"><select name="curDate" class="form<%= arrayColWidths(1) %>" id="curDate" onChange="document.search.submit()">
<%
response.write("<option value='ALL'>ALL</option>")
do until rsDates.EOF
response.write("<option value=" & rsDates.fields("dateStart"))
if CStr(rsDates.fields("dateStart")) = curDate then
response.write(" selected")
end if
response.write(">")
response.write(rsDates.fields("dateStart"))
response.write("</option>")
rsDates.MoveNext
loop
rsDates.Close
set rsDates = Nothing
%>
</select></td>
</tr>
<tr>
<td colspan="4" align="right" valign="top" class="footer"> </td>
</tr>
</form>
</table>
<br>
<table border="1" cellpadding="5" cellspacing="3" bordercolor="#CCCCCC">
<tr>
<td colspan="<%= colDisplayCount+1 %>" class="title">Search Results</td>
</tr>
<tr class="header">
<form name="sortForm" method="post" action="<%= pageName %>">
<td align="left"> </td>
<%
for x = 0 to UBound(arrayColNames)
if arrayColDisplay(x) = 1 then
curBullet = " /\"
if curSort = " ASC" then curBullet = " \/"
%>
<td align="left"<% if curColumn = arrayColNames(x) then response.write(" class='sel'") %>>
<% if Request.Form("submit") <> "Edit" and Request.Form("submit") <> "Delete" then %>
<a <% if curColumn = arrayColNames(x) then response.write(" class='sel' ") %> href="javascript: submitform('<%= arrayColNames(x) %>')"><%= arrayColNamesLong(x) %>
<% if curColumn = arrayColNames(x) then response.write(" "&curBullet) %>
<% else %>
<%= arrayColNamesLong(x) %>
<% end if %>
</a></td>
<%
end if
next
%>
<input name="curSort" type="hidden" value="<%= curSort %>">
<input name="curCol" type="hidden" value="<%= curColumn %>">
<input name="prevCol" type="hidden" value="<%= curColumn %>">
</form>
</tr>
<%
Do While Not rs.EOF
%>
<tr valign="top" class="content">
<form method="get" action="course.asp">
<td align="left"><input class="button" type="submit" value="View"><input name="curID" type="hidden" value="<%= rs.Fields(arrayColNames(0)).Value %>">
</td></form>
<%
for x = 0 to UBound(arrayColNames)
if arrayColDisplay(x) = 1 then
if arrayColFormObjects(x) = "checkBox" then
curCheck = ""
if rs.Fields(arrayColNames(x)).Value = 1 then curCheck = " checked"
%>
<td width="<%= arrayColWidths(x) %>" align="left" valign="top"<% if curColumn = arrayColNames(x) then response.write(" class='sel'") %>><input class="form<%= arrayColWidths(x) %>" name="<%= arrayColNames(x) %>" type="checkbox" value="1"<%= curCheck %> DISABLED></td>
<%
else
%>
<td width="<%= arrayColWidths(x) %>" align="left" valign="top"<% if curColumn = arrayColNames(x) then response.write(" class='sel'") %>>
<%
if rs.Fields(arrayColNames(x)).Value <> "" then
if arrayColFormObjects(x) = "dropDownLink" then
for y = 0 to UBound(Eval(arrayColNames(x)&"Array"))
if Eval(arrayColNames(x)&"Array("&y&")") = CStr(rs.Fields(arrayColNames(x)).Value) then
response.write(Eval(arrayColNames(x)&"NameArray("&y&")"))
end if
next
else
response.write(rs.Fields(arrayColNames(x)).Value)
end if
else
response.write(" ")
end if %>
</td>
<%
end if
end if
next
%>
</tr>
<%
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
%>
</table> </td>
</tr>
</table>
</body>
</html>
I finally joined up after quite some time peeking in at all of your helpfull information!
I've got a question for you all, i get the following error on a page for a site that i inherited here at work, and i'm going nuts, and am finally able to admit defeat!! Help!!
Microsoft VBScript compilation error '800a0409'
Unterminated string constant
/globallearn/traincalendar/intl/search.asp, line 86
Execute(arrayColNames(x) & "NameArray(" & counter & ") = """ &rs.Fields(dbColumns(x)).Value& """")
here's the code:
<%
'==============================================
' VARIABLES
'==============================================
dbName = "Dates"
dbPath = "external\courses.mdb"
dbTable = "tblDates"
dbColumnMain = "dateStart"
dbTables = Array("","","","","tblCourses","tblFacilitators","tblLocs","tblCountries","tblRegions","tblLangs","tblModes","","")
dbColumns = Array("","","","","title","name","address","name","name","name","name","","")
pageName = "search.asp"
arrayColNames = Array("ID","dateStart","dateEnd","regDead","name","facilitator","loc","country","region","lang","mode","datePost","dateMod")
arrayColNamesLong = Array("ID","Start Date","End Date","Registration Deadline","Name","Facilitator","Venue","Country","Region","Language","Mode","Post Date","Modified Date")
arrayColTypes = Array("int","date","date","date","int","int","int","int","int","int","int","datePost","dateMod")
arrayColWidths = Array("25","100","100","75","425","425","425","150","150","150","150","75","75")
arrayColFormObjects = Array("none","textField","textField","textField","dropDownLink","dropDownLink","dropDownLink","dropDownLink","dropDownLink","dropDownLink","dropDownLink","none","none")
arrayColDisplay = Array(0,1,1,1,1,1,1,1,1,1,1,0,0)
arrayColRequired = Array(0,1,1,1,1,1,1,1,1,1,1,1,1)
'==============================================
' COUNT DISPLAYED COLUMNS
'==============================================
colDisplayCount = 1
for x = 0 to UBound(arrayColDisplay)
if arrayColDisplay(x) = 1 then colDisplayCount = colDisplayCount + 1
next
'==============================================
' DATABASE CONNECTION
'==============================================
set conn= Server.CreateObject("ADODB.Connection")
conn.open "provider=microsoft.jet.oledb.4.0; data source=" & Server.MapPath(dbPath)
'=====================================================================
' Load Current Selections
'=====================================================================
curCourse=request.form("curCourse")
curFacilitator=request.form("curFacilitator")
curLoc=request.form("curLoc")
curCountry=request.form("curCountry")
curRegion=request.form("curRegion")
curMode=request.form("curMode")
curLang=request.form("curLang")
curDate=request.form("curDate")
' Verify Data
if curCourse = "" then curCourse="ALL"
if curFacilitator = "" then curFacilitator="ALL"
if curLoc = "" then curLoc="ALL"
if curCountry = "" then curCountry="ALL"
if curRegion = "" then curRegion="ALL"
if curMode = "" then curMode="ALL"
if curLang = "" then curLang="ALL"
if curDate = "" then curDate="ALL"
'==============================================
' DROPDOWN DATA LOAD
'==============================================
for x = 0 to UBound(arrayColFormObjects)
if arrayColFormObjects(x) = "dropDown" then
set rs=Server.CreateObject("ADODB.recordset")
sql = "SELECT DISTINCT " & arrayColNames(x) & " FROM "&dbTable&" ORDER BY " & arrayColNames(x) & " ASC"
rs.Open sql,conn
counter = 0
Execute("Dim " & arrayColNames(x) & "Array()")
Do While Not rs.EOF
Execute("Redim PRESERVE " & arrayColNames(x) & "Array(" & counter & ")")
Execute(arrayColNames(x) & "Array(" & counter & ") = """ & rs.Fields(arrayColNames(x)).Value & """")
counter = counter + 1
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
elseif arrayColFormObjects(x) = "dropDownLink" then
set rs=Server.CreateObject("ADODB.recordset")
sql = "SELECT DISTINCT "&dbTables(x)&".ID,"&dbTables(x)&"."&dbColumns(x)&" FROM "&dbTable&","&dbTables(x)&" ORDER BY "&dbTables(x)&"."&dbColumns(x)&" ASC"
rs.Open sql,conn
counter = 0
Execute("Dim " & arrayColNames(x) & "Array()")
Execute("Dim " & arrayColNames(x) & "NameArray()")
Do While Not rs.EOF
Execute("Redim PRESERVE " & arrayColNames(x) & "Array(" & counter & ")")
Execute("Redim PRESERVE " & arrayColNames(x) & "NameArray(" & counter & ")")
Execute(arrayColNames(x) & "Array(" & counter & ") = """ & rs.Fields("ID").Value & """")
Execute(arrayColNames(x) & "NameArray(" & counter & ") = """ &rs.Fields(dbColumns(x)).Value& """")
counter = counter + 1
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
end if
next
'==============================================
' DATABASE LOAD
'==============================================
curColumn = Request.Form("curCol")
prevColumn = Request.Form("prevCol")
curSort = Request.Form("curSort")
if curColumn = "" then curColumn = dbColumnMain
if Request.Form("submit") <> "Edit" and Request.Form("submit") <> "Delete" and Request.Form("submit") <> "Cancel" then
if curSort = " DESC" or curSort = "" or prevColumn <> curColumn then
curSort = " ASC"
else
curSort = " DESC"
end if
end if
curCourseSel = ""
curFacilitatorSel = ""
curLocSel = ""
curCountrySel = ""
curRegionSel = ""
curLangSel = ""
curModeSel = ""
curDateSel = ""
if curCourse <> "ALL" then curCourseSel = " AND "&dbTable&".name = "&curCourse
if curFacilitator <> "ALL" then curFacilitatorSel = " AND "&dbTable&".facilitator = "&curFacilitator
if curLoc <> "ALL" then curLocSel = " AND "&dbTable&".loc = "&curLoc
if curCountry <> "ALL" then curCountrySel = " AND "&dbTable&".country = "&curCountry
if curRegion <> "ALL" then curRegionSel = " AND "&dbTable&".region = "&curRegion
if curLang <> "ALL" then curLangSel = " AND "&dbTable&".lang = "&curLang
if curMode <> "ALL" then curModeSel = " AND "&dbTable&".mode = "&curMode
if curDate <> "ALL" then curDateSel = " AND "&dbTable&".dateStart = #"&curDate&"#"
if curCourseSel <> "" or curFacilitatorSel <> "" or curLocSel <> "" or curCountrySel <> "" or curRegionSel <> "" or curLangSel <> "" or curModeSel <> "" or curDateSel <> "" then
sql = "SELECT * FROM "&dbTable&" WHERE "&dbTable&".name = "&dbTable&".name"&curCourseSel&curFacilitatorSel&curRegionSel&curCountrySel&curLangSel&curLocSel&curModeSel&curDateSel&" ORDER BY " & curColumn & curSort
else
sql = "SELECT * FROM "&dbTable&" ORDER BY " & curColumn & curSort
end if
sqlCourses = "SELECT DISTINCT "&dbTables(4)&".ID, "&dbTables(4)&"."&dbColumns(4)&" FROM "&dbTables(4)&", "&dbTable&" WHERE "&dbTable&".name = "&dbTables(4)&".ID"&curCourseSel&curFacilitatorSel&curRegionSel&curCountrySel&curLangSel&curLocSel&curModeSel&curDateSel&" ORDER BY "&dbTables(4)&"."&dbColumns(4)
sqlFacilitators = "SELECT DISTINCT "&dbTables(5)&".ID, "&dbTables(5)&"."&dbColumns(5)&" FROM "&dbTables(5)&", "&dbTable&" WHERE "&dbTable&".facilitator = "&dbTables(5)&".ID"&curCourseSel&curFacilitatorSel&curRegionSel&curCountrySel&curLangSel&curLocSel&curModeSel&curDateSel&" ORDER BY "&dbTables(5)&"."&dbColumns(5)
sqlLocs = "SELECT DISTINCT "&dbTables(6)&".ID, "&dbTables(6)&"."&dbColumns(6)&" FROM "&dbTables(6)&", "&dbTable&" WHERE "&dbTable&".loc = "&dbTables(6)&".ID"&curCourseSel&curFacilitatorSel&curRegionSel&curCountrySel&curLangSel&curLocSel&curModeSel&curDateSel&" ORDER BY "&dbTables(6)&"."&dbColumns(6)
sqlCountries = "SELECT DISTINCT "&dbTables(7)&".ID, "&dbTables(7)&"."&dbColumns(7)&" FROM "&dbTables(7)&", "&dbTable&" WHERE "&dbTable&".country = "&dbTables(7)&".ID"&curCourseSel&curFacilitatorSel&curRegionSel&curCountrySel&curLangSel&curLocSel&curModeSel&curDateSel&" ORDER BY "&dbTables(7)&"."&dbColumns(7)
sqlRegions = "SELECT DISTINCT "&dbTables(8)&".ID, "&dbTables(8)&"."&dbColumns(8)&" FROM "&dbTables(8)&", "&dbTable&" WHERE "&dbTable&".region = "&dbTables(8)&".ID"&curCourseSel&curFacilitatorSel&curRegionSel&curCountrySel&curLangSel&curLocSel&curModeSel&curDateSel&" ORDER BY "&dbTables(8)&"."&dbColumns(8)
sqlLangs = "SELECT DISTINCT "&dbTables(9)&".ID, "&dbTables(9)&"."&dbColumns(9)&" FROM "&dbTables(9)&", "&dbTable&" WHERE "&dbTable&".lang = "&dbTables(9)&".ID"&curCourseSel&curFacilitatorSel&curRegionSel&curCountrySel&curLangSel&curLocSel&curModeSel&curDateSel&" ORDER BY "&dbTables(9)&"."&dbColumns(9)
sqlModes = "SELECT DISTINCT "&dbTables(10)&".ID, "&dbTables(10)&"."&dbColumns(10)&" FROM "&dbTables(10)&", "&dbTable&" WHERE "&dbTable&".mode = "&dbTables(10)&".ID"&curCourseSel&curFacilitatorSel&curRegionSel&curCountrySel&curLangSel&curLocSel&curModeSel&curDateSel&" ORDER BY "&dbTables(10)&"."&dbColumns(10)
sqlDates = "SELECT DISTINCT "&dbTable&".dateStart FROM "&dbTable&" WHERE "&dbTable&".dateStart = "&dbTable&".dateStart"&curCourseSel&curFacilitatorSel&curRegionSel&curCountrySel&curLangSel&curLocSel&curModeSel&curDateSel&" ORDER BY "&dbTable&".dateStart"
'==============================================
' OPEN RECORDS
'==============================================
set rs=Server.CreateObject("ADODB.recordset")
set rsCourses=Server.CreateObject("ADODB.recordset")
set rsFacilitators=Server.CreateObject("ADODB.recordset")
set rsLocs=Server.CreateObject("ADODB.recordset")
set rsCountries=Server.CreateObject("ADODB.recordset")
set rsRegions=Server.CreateObject("ADODB.recordset")
set rsLangs=Server.CreateObject("ADODB.recordset")
set rsModes=Server.CreateObject("ADODB.recordset")
set rsDates=Server.CreateObject("ADODB.recordset")
rs.Open sql,conn
rsCourses.Open sqlCourses, conn
rsFacilitators.Open sqlFacilitators, conn
rsLocs.Open sqlLocs, conn
rsCountries.Open sqlCountries, conn
rsRegions.Open sqlRegions, conn
rsLangs.Open sqlLangs, conn
rsModes.Open sqlModes, conn
rsDates.Open sqlDates, conn
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Wyndham Global Learning | Training Calendar</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
function submitform(curCol) {
document.sortForm.curCol.value = curCol
document.sortForm.submit();
}
</script>
<style>
<!--
/*-- MAIN -------------------------------------------------------------------*/
HTML, body, table {
font-family: Arial, Verdana, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
color: #000000;
background-color: #FFFFFF;
}
/*-- TABLE TITLE & HEADER ---------------------------------------------------*/
.title {
font-size: 14px;
font-weight: bold;
color: #FFFFFF;
background-color: #93AFD7;
}
.header {
font-weight: bold;
color: #5F6062;
background-color: #DFE5F3;
}
.headerSide {
color: #5F6062;
background-color: #F4F4F4;
}
.footer {
background-color: #DFE5F3;
}
/*-- TABLE CONTENTS ---------------------------------------------------------*/
.content {
font-size: 12px;
background-color: #FFFFFF;
}
.contentEdit {
font-size: 12px;
background-color: #F9FCC2;
}
.contentDelete {
font-size: 12px;
background-color: #FFCCCC;
}
/*-- TABLE SELECTED ------------------------------------------------*/
.header .sel {
color: #FFFFFF;
background-color: #1D74BA;
}
.content .sel {
background-color: #F4F4F4;
}
.contentEdit .sel {
background-color: #F3F984;
}
.contentDelete .sel {
background-color: #FFA4A4;
}
/*-- LINKS ------------------------------------------------------------------*/
a:link, visited {
font-size: 11px;
font-weight: bold;
color: #1D74BA;
text-decoration: none;
}
a:link .sel, visited .sel {
font-size: 11px;
font-weight: bold;
color: #FFFFFF;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:hover.sel {
text-decoration: underline;
}
/*-- FORM ELEMENTS ---------------------------------------------------------*/
input, textarea, select {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: normal;
}
.button {
font-size: 10px;
width: 50;
}
/*-- NOTES ----------------------------------------------------------------*/
.note {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #FFFFFF;
background-color: #C8D30C;
}
.warn {
color: #FFFFFF;
background-color: #990000;
}
.success {
color: #FFFFFF;
background-color: #006600;
}
-->
</style>
<%
'==============================================
' STYLE WIDTHS FOR FORM ELEMENTS
'==============================================
response.write("<style>" & vbcrlf)
response.write("<!--" & vbcrlf)
for x = 0 to UBound(arrayColWidths)
response.write(".form"&arrayColWidths(x)&" {width: "&arrayColWidths(x)&";}" & vbcrlf)
next
response.write("-->" & vbcrlf)
response.write("</style>" & vbcrlf)
%>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!--#include file="navMain.asp"-->
<table width="100%" border="0" cellspacing="20" cellpadding="0">
<tr>
<td>
<table border="1" cellspacing="3" cellpadding="5" bordercolor="#CCCCCC">
<tr>
<td colspan="4" class="title">Search</td>
</tr>
<form name="search" method="post" action="<%= pageName %>">
<tr>
<td align="right" valign="top" class="headerSide">Course:</td>
<td colspan="3" align="left" valign="top" class="content"><select name="curCourse" class="form<%= arrayColWidths(4) %>" onChange="document.search.submit()">
<%
response.write("<option value=ALL>ALL</option>")
do until rsCourses.EOF
response.write("<option value=" & rsCourses.fields("ID"))
if CStr(rsCourses.fields("ID")) = curCourse then
response.write(" selected")
end if
response.write(">")
response.write(rsCourses.fields("title"))
response.write("</option>")
rsCourses.MoveNext
loop
rsCourses.Close
set rsCourses = Nothing
%>
</select></td>
</tr>
<tr>
<td align="right" valign="top" class="headerSide">Facilitator:</td>
<td colspan="3" align="left" valign="top" class="content"><select name="curFacilitator" class="form<%= arrayColWidths(5) %>" onChange="document.search.submit()">
<%
response.write("<option value=ALL>ALL</option>")
do until rsFacilitators.EOF
response.write("<option value=" & rsFacilitators.fields("ID"))
if CStr(rsFacilitators.fields("ID")) = curFacilitator then
response.write(" selected")
end if
response.write(">")
response.write(rsFacilitators.fields("name"))
response.write("</option>")
rsFacilitators.MoveNext
loop
rsFacilitators.Close
set rsFacilitators = Nothing
%>
</select></td>
</tr>
<tr>
<td align="right" valign="top" class="headerSide">Venue: </td>
<td colspan="3" align="left" valign="top" class="content"><select name="curLoc" class="form<%= arrayColWidths(6) %>" onChange="document.search.submit()">
<%
response.write("<option value='ALL'>ALL</option>")
do until rsLocs.EOF
response.write("<option value=" & rsLocs.fields("ID"))
if CStr(rsLocs.fields("ID")) = curLoc then
response.write(" selected")
end if
response.write(">")
response.write(rsLocs.fields("address"))
response.write("</option>")
rsLocs.MoveNext
loop
rsLocs.Close
set rsLocs = Nothing
%>
</select></td>
</tr>
<tr>
<td align="right" valign="top" class="headerSide">Country:</td>
<td align="left" valign="top" class="content"><select name="curCountry" class="form<%= arrayColWidths(7) %>" onChange="document.search.submit()">
<%
response.write("<option value='ALL'>ALL</option>")
do until rsCountries.EOF
response.write("<option value=" & rsCountries.fields("ID"))
if CStr(rsCountries.fields("ID")) = curCountry then
response.write(" selected")
end if
response.write(">")
response.write(rsCountries.fields("name"))
response.write("</option>")
rsCountries.MoveNext
loop
rsCountries.Close
set rsCountries = Nothing
%>
</select></td>
<td align="right" valign="top" class="headerSide">Language:</td>
<td align="left" valign="top" class="content"><select name="curLang" class="form<%= arrayColWidths(9) %>" onChange="document.search.submit()">
<%
response.write("<option value='ALL'>ALL</option>")
do until rsLangs.EOF
response.write("<option value=" & rsLangs.fields("ID"))
if CStr(rsLangs.fields("ID")) = curLang then
response.write(" selected")
end if
response.write(">")
response.write(rsLangs.fields("name"))
response.write("</option>")
rsLangs.MoveNext
loop
rsLangs.Close
set rsLangs = Nothing
%>
</select></td>
</tr>
<tr>
<td align="right" valign="top" class="headerSide">Region:</td>
<td align="left" valign="top" class="content"><select name="curRegion" class="form<%= arrayColWidths(8) %>" onChange="document.search.submit()">
<%
response.write("<option value='ALL'>ALL</option>")
do until rsRegions.EOF
response.write("<option value=" & rsRegions.fields("ID"))
if CStr(rsRegions.fields("ID")) = curRegion then
response.write(" selected")
end if
response.write(">")
response.write(rsRegions.fields("name"))
response.write("</option>")
rsRegions.MoveNext
loop
rsRegions.Close
set rsRegions = Nothing
%>
</select></td>
<td align="right" valign="top" class="headerSide">Delivery Mode:</td>
<td align="left" valign="top" class="content"><select name="curMode" class="form<%= arrayColWidths(10) %>" onChange="document.search.submit()">
<%
response.write("<option value='ALL'>ALL</option>")
do until rsModes.EOF
response.write("<option value=" & rsModes.fields("ID"))
if CStr(rsModes.fields("ID")) = curMode then
response.write(" selected")
end if
response.write(">")
response.write(rsModes.fields("name"))
response.write("</option>")
rsModes.MoveNext
loop
rsModes.Close
set rsModes = Nothing
%>
</select></td>
</tr>
<tr>
<td align="right" valign="top" class="headerSide">Start Dates: </td>
<td colspan="3" align="left" valign="top" class="content"><select name="curDate" class="form<%= arrayColWidths(1) %>" id="curDate" onChange="document.search.submit()">
<%
response.write("<option value='ALL'>ALL</option>")
do until rsDates.EOF
response.write("<option value=" & rsDates.fields("dateStart"))
if CStr(rsDates.fields("dateStart")) = curDate then
response.write(" selected")
end if
response.write(">")
response.write(rsDates.fields("dateStart"))
response.write("</option>")
rsDates.MoveNext
loop
rsDates.Close
set rsDates = Nothing
%>
</select></td>
</tr>
<tr>
<td colspan="4" align="right" valign="top" class="footer"> </td>
</tr>
</form>
</table>
<br>
<table border="1" cellpadding="5" cellspacing="3" bordercolor="#CCCCCC">
<tr>
<td colspan="<%= colDisplayCount+1 %>" class="title">Search Results</td>
</tr>
<tr class="header">
<form name="sortForm" method="post" action="<%= pageName %>">
<td align="left"> </td>
<%
for x = 0 to UBound(arrayColNames)
if arrayColDisplay(x) = 1 then
curBullet = " /\"
if curSort = " ASC" then curBullet = " \/"
%>
<td align="left"<% if curColumn = arrayColNames(x) then response.write(" class='sel'") %>>
<% if Request.Form("submit") <> "Edit" and Request.Form("submit") <> "Delete" then %>
<a <% if curColumn = arrayColNames(x) then response.write(" class='sel' ") %> href="javascript: submitform('<%= arrayColNames(x) %>')"><%= arrayColNamesLong(x) %>
<% if curColumn = arrayColNames(x) then response.write(" "&curBullet) %>
<% else %>
<%= arrayColNamesLong(x) %>
<% end if %>
</a></td>
<%
end if
next
%>
<input name="curSort" type="hidden" value="<%= curSort %>">
<input name="curCol" type="hidden" value="<%= curColumn %>">
<input name="prevCol" type="hidden" value="<%= curColumn %>">
</form>
</tr>
<%
Do While Not rs.EOF
%>
<tr valign="top" class="content">
<form method="get" action="course.asp">
<td align="left"><input class="button" type="submit" value="View"><input name="curID" type="hidden" value="<%= rs.Fields(arrayColNames(0)).Value %>">
</td></form>
<%
for x = 0 to UBound(arrayColNames)
if arrayColDisplay(x) = 1 then
if arrayColFormObjects(x) = "checkBox" then
curCheck = ""
if rs.Fields(arrayColNames(x)).Value = 1 then curCheck = " checked"
%>
<td width="<%= arrayColWidths(x) %>" align="left" valign="top"<% if curColumn = arrayColNames(x) then response.write(" class='sel'") %>><input class="form<%= arrayColWidths(x) %>" name="<%= arrayColNames(x) %>" type="checkbox" value="1"<%= curCheck %> DISABLED></td>
<%
else
%>
<td width="<%= arrayColWidths(x) %>" align="left" valign="top"<% if curColumn = arrayColNames(x) then response.write(" class='sel'") %>>
<%
if rs.Fields(arrayColNames(x)).Value <> "" then
if arrayColFormObjects(x) = "dropDownLink" then
for y = 0 to UBound(Eval(arrayColNames(x)&"Array"))
if Eval(arrayColNames(x)&"Array("&y&")") = CStr(rs.Fields(arrayColNames(x)).Value) then
response.write(Eval(arrayColNames(x)&"NameArray("&y&")"))
end if
next
else
response.write(rs.Fields(arrayColNames(x)).Value)
end if
else
response.write(" ")
end if %>
</td>
<%
end if
end if
next
%>
</tr>
<%
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
%>
</table> </td>
</tr>
</table>
</body>
</html>