The I have two
SQL statements in the page I'm trying to load.
SELECT PermissionText FROM TblPermissions WHERE PermissionLevel = 4
SELECT NameFirst FROM TblIndividuals WHERE ID = 1850
both test out fine on the local copy of the database (which is synched with the online one.)
the lines immediately proceeding and the calling lines are (respectively):
Session("user") = ID
Session("ForceChange") = ForceChange
Session("myState") = Permissions
Session("myTeacherID") = TeacherID
Session("mySchoolCode") = SchoolCode
myStatus = GetValue(Permissions, "permissions")
myName = GetValue( ID, "reviewer")
Session("myStatus") = myStatus
Session("myName") =myName
which returns the following if printed out
user: 1850
ForceChange: False
myState: 4
myTeacherID:
mySchoolCode:
myStatus:
myName:
The entire function is :
- Code: Select all
<%
function GetValue(ID, itemType)
'The ID is the ID number of the item.
' itemType controls what lookup you use. i.e. culture, level, reviewer
dim selectItem
dim tableName
dim criteriaName
if ID = "" or itemType = "" then exit function
if not isNumeric(ID) then exit function
itemType = LCase(itemType)
SELECT Case itemType
case "culture"
selectItem="Culture"
tableName="TblCultures"
criteriaName="ID"
case "level"
selectItem= "MyLevel"
tableName="TblLevels"
criteriaName="LevelID"
case "reviewer"
selectItem="NameFirst"
tableName="TblIndividuals"
criteriaName="ID"
case "email"
selectItem="Email"
tableName="TblIndividuals"
criteriaName="ID"
case "reviewerlocation"
selectItem = "NameFirst & ' ' & NameLast & iif(Location>'', ', ' & Location, '') as reviewer"
tableName="TblIndividuals"
criteriaName="ID"
case "permissions"
selectItem="PermissionText"
tableName="TblPermissions"
criteriaName="PermissionLevel"
case else
exit function
end Select
vSQL= join(array("SELECT", selectItem, _
"FROM", tableName, _
"WHERE", criteriaName, "=", ID), " ")
response.write "
" & vSQL
set valueClient = Server.CreateObject("ADODB.Recordset")
valueClient.open vSQL, conn,3,3
response.write ":" & valueClient.recordcount
if not valueClient.EOF then
GetValue=valueClient(0)
else
GetValue = ""
end if
response.write ":" & GetValue
valueClient.close
end function
%>
Is that enough? I'll put the calling page and the relevant function calls in another post so it's easier to read (or ignore)
thanks!
jakyra