I am writing code on a page to upload files.I wanted to test this code but I am getting database error in the functions which already existed before. I have checked the code for missing variables if any but everything seems to be fine. Due to this I am not able to test the code I wrote.I get the following error:
An Error Was Encountered!. Description: Variable is undefined. Number: 500. Source: Microsoft VBScript runtime error.
Database error encountered in DBGetCoursesJS(). Please contact your SharedHR Administrator.
Following is the code for the method:
function DBGetCoursesJS()
Dim objRS, sSQL
Dim strSelected
DBGetCoursesJS = false
sSQL = "SELECT CourseID, CourseName, DefaultVendor, DefaultTrainer, DefaultLocation, DefaultHours, DefaultLifeSpan"
sSQL = sSQL & " FROM TrainingCourses"
sSQL = sSQL & " WHERE CompID = " & intCompID
sSQL = sSQL & " AND ProgramID = " & intProgramID
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open sSQL, objConnect, adOpenStatic, adLockReadOnly, adCmdText
if DBCheckError() then
strClientMessage = strClientMessage & "Database error encountered in DBGetCoursesJS(). Please contact your " & strAppTitle & " Administrator." & vbCRLF
DbGetCoursesJS = false
exit function
end if
Dim iCnt, strArrayItem
iCnt = 0
while not objRS.EOF
strArrayItem = ""
strArrayItem = "arrCourses[" & iCnt & "] = new Course("""
strArrayItem = strArrayItem & objRS("CourseID") & """, """
strArrayItem = strArrayItem & objRS("CourseName") & """, """
strArrayItem = strArrayItem & objRS("DefaultVendor") & """, """
strArrayItem = strArrayItem & objRS("DefaultTrainer") & """, """
strArrayItem = strArrayItem & objRS("DefaultLocation") & """, """
strArrayItem = strArrayItem & objRS("DefaultHours") & """, """
strArrayItem = strArrayItem & objRS("DefaultLifeSpan") & """);"
Response.Write(strArrayItem & vbNewLine)
iCnt = iCnt + 1
objRS.MoveNext
wend
objRS.Close
Set objRS = Nothing
DbGetCoursesJS = true
end function