%
Function SendFieldVal(recordSet, varName, addnew, defaultValue)
if addnew then
if defaultValue = Null then
SendFieldVal = ""
else
SendFieldVal = defaultValue
end if
else
SendFieldVal = decode(recordSet(varName))
end if
End Function
'------------------------------------------------
function CheckTheBox(instring)
if isnull(instring) then
instring = false
end if
if CBool(instring) then
CheckTheBox = "checked"
end if
end function
'-----------------------------------------------
function MakeNull(instring)
if instring = "" or instring = "Null" then
MakeNull = Null
else
MakeNull = instring
end if
end function
'------------------------------------------------
Function CheckBoxVal(instring)
If instring = "on" or instring = "true" or instring = true Then
CheckBoxVal = 1
Else
CheckBoxVal = 0
End If
End Function
sub checkError(SPError, returnCode)
if len(SPError) > 1 then
writeJSDebug(SPError)
elseif returnCode > 0 then
dim oConnRC, oCmdRC
set oConnRC = Server.CreateObject("ADODB.Connection")
oConnRC.Open strConn
set oCmdRC = Server.CreateObject("ADODB.Command")
oCmdRC.ActiveConnection = oConnRC
oCmdRC.CommandText = "sp_Get_ReturnCode"
oCmdRC.CommandType = adCmdStoredProc
oCmdRC.Parameters.Append oCmdRC.CreateParameter("@ret", adInteger, adParamReturnValue)
oCmdRC.Parameters.Append oCmdRC.CreateParameter("@pCode", adInteger, adParamInput, , returnCode)
oCmdRC.Parameters.Append oCmdRC.CreateParameter("@pDescription", adVarChar, adParamOutput, 255)
oCmdRC.Execute
writeJSDebug("ERROR " & returnCode & ": " & oCmdRC("@pDescription"))
end if
end sub
'----------------------
Sub BuildUploadRequest(RequestBin)
dim PosBeg, PosEnd, boundary, boundaryPos, Pos, Name, PosFile, PosBound, fileName
dim contentType, Value
'Get the boundary
PosBeg = 1
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
boundaryPos = InstrB(1,RequestBin,boundary)
'Get all data inside the boundaries
Do until (boundaryPos=InstrB(RequestBin,boundary & getByteString("--")))
'Members variable of objects are put in a dictionary object
Dim UploadControl
Set UploadControl = CreateObject("Scripting.Dictionary")
'Get an object name
Pos = InstrB(BoundaryPos,RequestBin,getByteString("Content-Disposition"))
Pos = InstrB(Pos,RequestBin,getByteString("name="))
PosBeg = Pos+6
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34)))
Name = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
PosFile = InstrB(BoundaryPos,RequestBin,getByteString("filename="))
PosBound = InstrB(PosEnd,RequestBin,boundary)
'Test if object is of file type
If PosFile<>0 AND (PosFile