I’m getting Error code 800A0409, Unterminated string constant, on line 1, 54 with the code below.
Option Explicit
Dim ObjProgressMsg
Dim fso,objText,strVstup,strVystup,f,dtmVyt,dtmF,dDiff,fName,fExt,fShort,dtmAkt,tx,msgText
Dim strMessage,strWindowTitle,strTemp,wshShell,objTempMessage,strTempVBS
Set fso = CreateObject("Scripting.FileSystemObject")
Set objText = fso.GetFile("l:batposledni.den")
strVstup = "l:filefolder"
strVystup = "l:backup"
dtmVyt = objText.DateLastModified
msgText = "Some text about copying and renaming" & VbCrLf & "files, please wait..."
ProgressMsg msgText
For Each f In fso.GetFolder(strVstup).Files
dtmF = f.DateLastModified
dDiff = DateDiff("s", dtmF, dtmVyt)
If dDiff < 0 Then
ProgressMsg ""
WScript.Echo f
End If
Next
WScript.Echo "Some text about the task being finished."
Function ProgressMsg( strMessage )
' Written by Denis St-Pierre
' Displays a progress message box that the originating script can kill in both 2k and XP
' If StrMessage is blank, take down previous progress message box
' Using 4096 in Msgbox below makes the progress message float on top of things
' CAVEAT: You must have Dim ObjProgressMsg at the top of your script for this to work as described
Set wshShell = WScript.CreateObject( "WScript.Shell" )
strTEMP = wshShell.ExpandEnvironmentStrings( "%TEMP%" )
If strMessage = "" Then
' Disable Error Checking in case objProgressMsg doesn't exists yet
On Error Resume Next
' Kill ProgressMsg
objProgressMsg.Terminate( )
' Re-enable Error Checking
On Error Goto 0
Exit Function
End If
strTempVBS = strTEMP + "" & "Message.vbs" 'Control File for reboot
' Create Message.vbs, True=overwrite
Set objTempMessage = fso.CreateTextFile( strTempVBS, True )
objTempMessage.WriteLine( "MsgBox""" & strMessage & """, 4096, """ & "a_sp_rano" & """" )
objTempMessage.Close
' Disable Error Checking in case objProgressMsg doesn't exists yet
On Error Resume Next
' Kills the Previous ProgressMsg
objProgressMsg.Terminate( )
' Re-enable Error Checking
On Error Goto 0
' Trigger objProgressMsg and keep an object on it
Set objProgressMsg = WshShell.Exec( "%windir%system32wscript.exe " & strTempVBS )
End Function
The script should show a msgbox while searching for files newer than last modified date of posledni.den file. Then once it finds a file it should close msgbox and echo the file it found.
It works just fine if I change this:
msgText = "Some text about copying and renaming" & VbCrLf & "files, please wait..."
to this:
msgText = "Some text about copying and renaming" & "files, please wait..."
Removal of VbCrLf seems to fix that error, just no line break is obviously happening. I can’t figure out why it’s behaving like that, what am I doing wrong. Every kind of insight on the problem would be much appreciated.
Thank you in advance.
- Remove From My Forums
-
Question
-
Hi,
Ths VBS is for a generating html file.
But ending with Code 800A0409 — Unterminated string constant line ending at the TSQL («drop table #cpu_usage
This TSQL is executing fine in sql server, but calling from vbs getting error
Could some one help me here
Set objConnection = CreateObject(«ADODB.Connection»)
objConnection.Open _
«Provider=SQLOLEDB;Data Source=» & strComputer & «;» & _
«Trusted_Connection=Yes;Initial Catalog=Master»
Set objRecordset = objConnection.Execute(«drop table #cpu_usage
declare @ts_now bigint
select @ts_now = ms_ticks from sys.dm_os_sys_info
select top 10 dateadd (ms, (y.[timestamp] -@ts_now), GETDATE()) as EventTime,SQLProcessUtilization,SystemIdle, 100 — SystemIdle — SQLProcessUtilization as OtherProcessUtilization
into #cpu_usage
from ( select @@servername as Instancename, record.value(‘(./Record/@id)[1]’, ‘int’) as record_id,
record.value(‘(./Record/SchedulerMonitorEvent/SystemHealth/SystemIdle)[1]’, ‘int’)
as SystemIdle, record.value(‘(./Record/SchedulerMonitorEvent/SystemHealth/ProcessUtilization)[1]’,
‘int’) as SQLProcessUtilization,
timestamp from ( select timestamp, convert(xml, record) as record from sys.dm_os_ring_buffers
where ring_buffer_type = N’RING_BUFFER_SCHEDULER_MONITOR’
and record like ‘%<SystemHealth>%’) as x
) as y
order by record_id desc
go
select * from #cpu_usage»)
Answers
-
Does VB (VBS) have ability to create a long text variable? I think the problem is that you can not put that whole string with carriage returns exactly in one line in VBs. You need to somehow create a string variable that will hold your script and use that
variable in the Execute command. Also, remove GO from your script, GO is not a T-SQL command.
-
Edited by
Wednesday, May 4, 2016 7:02 PM
-
Proposed as answer by
Sam ZhaMicrosoft contingent staff
Thursday, May 5, 2016 3:21 AM -
Marked as answer by
Sam ZhaMicrosoft contingent staff
Thursday, May 12, 2016 1:49 PM
-
Edited by
-
Hi Shivanq,
Based on my test, you could use the following script.
objConnection.Execute (" If object_ID(N'tempdb.dbo.#cpu_usage') is not NULL " & Chr(13) & Chr(10) & _ " drop table #cpu_usage " & Chr(13) & Chr(10) & _ " declare @ts_now bigint " & Chr(13) & Chr(10) & _ " select @ts_now = ms_ticks from sys.dm_os_sys_info " & Chr(13) & Chr(10) & _ " select top 10 dateadd (ms, (y.[timestamp] -@ts_now), GETDATE()) as EventTime,SQLProcessUtilization,SystemIdle, 100 - SystemIdle - SQLProcessUtilization as OtherProcessUtilization " & Chr(13) & Chr(10) & _ " into #cpu_usage " & Chr(13) & Chr(10) & _ " from ( select @@servername as Instancename, record.value('(./Record/@id)[1]', 'int') as record_id, " & Chr(13) & Chr(10) & _ " record.value('(./Record/SchedulerMonitorEvent/SystemHealth/SystemIdle)[1]', 'int') as SystemIdle, " & Chr(13) & Chr(10) & _ " record.value('(./Record/SchedulerMonitorEvent/SystemHealth/ProcessUtilization)[1]', 'int') as SQLProcessUtilization, " & Chr(13) & Chr(10) & _ " timestamp " & Chr(13) & Chr(10) & _ " from ( select timestamp, convert(xml, record) as record from sys.dm_os_ring_buffers " & Chr(13) & Chr(10) & _ " where ring_buffer_type = N'RING_BUFFER_SCHEDULER_MONITOR' " & Chr(13) & Chr(10) & _ " and record like '%<SystemHealth>%' " & Chr(13) & Chr(10) & _ " ) as x " & Chr(13) & Chr(10) & _ " ) as y " & Chr(13) & Chr(10) & _ " order by record_id desc ") Set objRecordset = objConnection.Execute("select * from #cpu_usage")
Sam Zha
TechNet Community Support-
Proposed as answer by
Naomi N
Thursday, May 5, 2016 3:58 AM -
Marked as answer by
Sam ZhaMicrosoft contingent staff
Thursday, May 12, 2016 1:49 PM
-
Proposed as answer by
What am I missing in the .asp code? I keep getting this error:
Microsoft VBScript compilation error ‘800a0409’
Unterminated string constant
/indigo_privatedining.asp, line 31
Mailer.AddRecipient «TEST»,»rickardp@guestservices.com,
———————————————————^
but cannot see what I am missing
<%
Response.Buffer = true
Dim body
body = ""
body = body & "Today's Date: " & Request.Form("Date") &vbcrlf &vbcrlf
body = body & "First Name: " & Request.Form("FirstName") &vbcrlf &vbcrlf
body = body & "Last Name: " & Request.Form("LastName") &vbcrlf &vbcrlf
body = body & "Callback No: " & Request.Form("Phone") &vbcrlf &vbcrlf
body = body & "Email: " & Request.Form("EmailFrom") &vbcrlf &vbcrlf
body = body & "Fax No.: " & Request.Form("Fax") &vbcrlf &vbcrlf
body = body & "Date of Event: " & Request.Form("EventDate") &vbcrlf &vbcrlf
body = body & "Time of Event: " & Request.Form("EventTime") &vbcrlf &vbcrlf
body = body & "Estimated No. People: " & Request.Form("EstimatedNumberPeople") &vbcrlf &vbcrlf
body = body & "Type of Event: " & Request.Form("EventType") &vbcrlf &vbcrlf
body = body & "Yes, Send me Info: " & Request.Form("Yes_I_want_info") &vbcrlf &vbcrlf
body = body & "Visited Indigo Before?: " & Request.Form("VisitIndigoBefore") &vbcrlf &vbcrlf
body = body & "How Learned about Indigo: " & Request.Form("How_Did_You_Learn_About_Indigo") &vbcrlf &vbcrlf
body = body & "Other: " & Request.Form("Other") &vbcrlf &vbcrlf
body = body & "Comments: " & Request.Form("Comments") &vbcrlf &vbcrlf
'Response.write body
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName= Request("rickardp@guestservices.com")
Mailer.ReplyTo= Request("EmailFrom")
Mailer.FromAddress= Request("EmailFrom")
Mailer.CC= Request("EmailFrom")
Mailer.RemoteHost = "mail-fwd"
'mailer.qmessage = true
Mailer.AddRecipient "TEST","rickardp@guestservices.com,
Mailer.AddBCC "Web Marketing Analyst","floreroc@guestservices.com"
Mailer.Subject = "Indigo Landing Private Dining Inquiry"
Mailer.BodyText = body
if Mailer.SendMail then
response.Redirect("http://www.indigolanding.com/indigo_thankyouprivate.htm")
else
Response.Write "Mail send failure. Error was " & Mailer.Response
end if
%>
Open in new window
I took this script from a website. I am trying to add shortcuts to taskbar and start menu on windows 8. My VBScript knowledge is quite weak. I’m pretty sure I am just missing a » somewhere but I’m not exactly sure where. The first ‘String’ after the Else WScript.Echo is not showing up in blue in my text editor as it should be so there may be something there as well. Any help would be much appreciated. (The error is claiming to be on 5, 60)
'Pin an application to a start menu or task bar
If WScript.Arguments.Count = 3 then
Call PinApplicationToTaskBar(WScript.Arguments(0), WScript.Arguments(1), WScript.Arguments(2))
Else
WScript.Echo "Missing parameters. String AppPathAndName _
String ShortcutName Boolean OnStartMenu." & vbCr & vbCr & " _
Example cmd.exe CMD false" & vbCr & vbCr & _
" Example %windir%system32SnippingTool.exe SnipIt false"
End If
Public Sub PinApplicationToTaskBar(AppPathAndName, ShortcutName, OnStartMenu)
'This is on for a soft failure.
'Uncomment this if error checking for a hard failure is needed for debugging.
On Error Resume Next
Dim FileSystemObj, ObjShell, ObjShellApp
Set ObjShell = WScript.CreateObject("WScript.Shell")
Set FileSystemObj = CreateObject("Scripting.FileSystemObject")
'Create a temp location for the short-cut to exist
TempShortcutLocation = FileSystemObj.GetFolder_
(ObjShell.ExpandEnvironmentStrings("%TEMP%"))
'Where is it being pinned too? Determine the location where the pinned item will reside.
If(trim(lcase(OnStartMenu)) = "true") then ' pinned to start menu
HasItAlreadyBeenPinnedShortCut = ObjShell.ExpandEnvironmentStrings_
("%APPDATA%") & _
"MicrosoftInternet ExplorerQuick LaunchUser PinnedStartMenu"
Else
HasItAlreadyBeenPinnedShortCut = ObjShell.ExpandEnvironmentStrings_
("%APPDATA%") & _
"MicrosoftInternet ExplorerQuick LaunchUser PinnedTaskBar"
End If
'Temporary location for the application short-cut
TempShortcut = TempShortcutLocation & "" & ShortcutName & ".lnk"
'Possible location of a pinned item
HasItAlreadyBeenPinnedShortCut = HasItAlreadyBeenPinnedShortCut & "" & ShortcutName & ".lnk"
'If this already exists, than exit this procedure. The application has already been pinned.
If(FileSystemObj.FileExists(HasItAlreadyBeenPinnedShortCut)) Then
'MsgBox(HasItAlreadyBeenPinnedShortCut & " Already Pinned")
Set ObjShell = Nothing
Set FileSystemObj = Nothing
Exit Sub
End If
'Create a short-cut using the shell
Set lnk = ObjShell.CreateShortcut(TempShortcut)
lnk.TargetPath = AppPathAndName ' Full application path and name
lnk.Arguments = ""
lnk.Description = ShortcutName 'The name that appears on the start menu.
lnk.Save
Set ObjShellApp = CreateObject("Shell.Application")
'Get the newly created short-cut full path
Set ShortCutToPin = ObjShellApp.NameSpace(TempShortcutLocation)
If(FileSystemObj.FileExists(TempShortcut)) Then
Dim ShortCutToPinItem, verb
'Set the location to pin the item to do based on the passed OnStartMenu argument
If(trim(lcase(OnStartMenu)) = "true") then
verbToDo = "Pin to Start Men&u"
Else
verbToDo = "Pin to Tas&kbar"
End If
For Each ShortCutToPinItem in ShortCutToPin.Items()
'Look for the pinning verb when the temporary short-cut name matches the passed ShortcutName argument
If (ShortCutToPinItem.Name = ShortcutName) Then
'Loop through the shell object's (the short-cut) commands looking for the pinning method.
For Each verb in ShortCutToPinItem.Verbs
'The verb matches the verbToDo so pin it to verb's defined location
If (verb.Name = verbToDo) Then verb.DoIt
Next
End If
Next
'Delete the temporary short-cut used to pin the application
FileSystemObj.DeleteFile(TempShortcut)
End If
'clean up
Set ObjShell = Nothing
Set FileSystemObj = Nothing
Set ObjShellApp = Nothing
End Sub
For reference and credit, the code came from here. http://www.codeproject.com/Tips/713824/Pin-a-shortcut-onto-the-Taskbar-or-Start-Menu
asked Apr 8, 2014 at 1:38
This string concatenation is messed up. It should look like this:
WScript.Echo "Missing parameters. String AppPathAndName " & _
"String ShortcutName Boolean OnStartMenu." & vbCr & vbCr & _
"Example cmd.exe CMD false" & vbCr & vbCr & _
"Example %windir%system32SnippingTool.exe SnipIt false"
You must use both the line continuation (_
) and the string concatenation (&
) operators to concat strings across multiple lines in VBScript. Make sure all string literals are closed (every quote has a matching closing quote on the same line).
answered Apr 8, 2014 at 1:54
BondBond
16.1k6 gold badges30 silver badges53 bronze badges
5
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 = «externalcourses.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>