File: D:/HostingSpaces/RImmers/duitsedog.tk/wwwroot/includes/inc_conversies.asp
<%
' http://intradev.wildher.nl
' ============================================================
' Purpose:
'
'
' Notes:
'
' ============================================================
' $Workfile: inc_conversions.asp $
' $Author: Mms $
' $Date: 2/05/02 2:58p $
' $Modtime: 2/05/02 2:58p $
' $Revision: 5 $
' ============================================================
' Function BoolToSQL (ByVal blnParam)
' Function DateToSQL (ByVal datParam)
' Function DblToSQL (ByVal dblParam)
' Function IntToSQL (ByVal intParam)
' Function LngToSQL (ByVal lngParam)
' Function StrToSQL (ByVal strParam)
' Function StrToLSQL (ByVal strParam)
' ============================================================
' Function BoolToForm (ByVal blnParam)
' Function DblToForm (ByVal dblParam)
' Function IntToForm (ByVal intParam)
' Function LngToForm (ByVal lngParam)
' Function StrToForm (ByVal strParam)
' ============================================================
' Function FormToBool (ByVal strParam)
' Function FormToDbl (ByVal strParam)
' Function FormToInt (ByVal strParam)
' Function FormToLng (ByVal strParam)
' Function FormToStr (ByVal strParam)
' ============================================================
' Function BoolToHTML (ByVal blnParam)
' Function DblToHTML (ByVal dblParam)
' Function IntToHTML (ByVal intParam)
' Function LngToHTML (ByVal lngParam)
' Function StrToHTML (ByVal strParam)
' ============================================================
' Function BoolToUrl (ByVal blnParam)
' Function DblToUrl (ByVal dblParam)
' Function IntToUrl (ByVal intParam)
' Function LngToUrl (ByVal lngParam)
' Function StrToUrl (ByVal strParam)
' ============================================================
' Function BoolToInt (ByVal blnParam)
'=============================================================
Function BoolToSQL (ByVal blnParam)
If IsNull(blnParam) Then
BoolToSQL = "null"
Else
If blnParam Then
BoolToSQL = "1"
Else
BoolToSQL = "0"
End if
End If
End Function
Function DateToSQL (ByVal datParam)
Dim strDate
If IsNull(datParam) Then
DateToSQL = "null"
Else
'DateToSql = "'" & DateSerial(Year(datParam),Month(datParam),Day(datParam)) & " " & TimeSerial(Hour(datParam),Minute(datParam),Second(datParam)) & "'"
strDate = Month(datParam) & "/" & Day(datParam) & "/" & Year(datParam)
'strDate = datParam
DateToSql = "#" & strDate & "#"
End If
End Function
Function DblToSQL (ByVal dblParam)
If IsNull(dblParam) Then
DblToSQL = "null"
Else
DblToSQL = CStr(dblParam)
End If
End Function
Function IntToSQL (ByVal intParam)
If IsNull(intParam) Then
IntToSQL = "null"
Else
IntToSQL = CStr(intParam)
End If
End Function
Function LngToSQL (ByVal lngParam)
If IsNull(lngParam) Then
LngToSQL = "null"
Else
LngToSQL = CStr(lngParam)
End If
End Function
Function StrToSQL (ByVal strParam)
If IsNull(strParam) Then
StrToSQL = "null"
Else
StrToSQL = "'" & Replace(strParam,"'","''") & "'"
End If
End Function
Function StrToLSQL (ByVal strParam, ByVal intLen)
If IsNull(strParam) Then
StrToLSQL = "null"
Else
StrToLSQL = "'" & Replace(Left(strParam,intLen),"'","''") & "'"
End If
End Function
' ============================================================
Function SQLToBool (ByVal Param)
If Not IsNull(param) then
If CInt(Param) = 1 Then
SQLToBool = true
Else
SQLToBool = false
End If
Else
SQLToBool = Null
End If
End Function
Function SQLToDate (ByVal Param)
If Not IsNull(param) then
SQLToDate = CDate(Param)
Else
SQLToDate = Null
End If
End Function
Function SQLToDbl (ByVal Param)
If Not IsNull(param) then
SQLToDbl = CDbl(Param)
Else
SQLToDbl = Null
End If
End Function
Function SQLToInt(ByVal Param)
If Not IsNull(param) then
SQLToInt = CLng(Param)
Else
SQLToInt = Null
End If
End Function
Function SQLToLng (ByVal Param)
If Not IsNull(param) then
SQLToLng = CLng(param)
Else
SQLToLng = Null
End If
End Function
Function SQLToStr (ByVal Param)
If Not IsNull(param) then
SQLToStr = CStr(Param)
Else
SQLToStr = Null
End If
End Function
' ============================================================
Function BoolToForm (ByVal blnParam)
If IsNull(blnParam) Then
BoolToForm = ""
Else
BoolToForm = CStr(blnParam)
End If
End Function
Function DblToForm (ByVal dblParam)
If IsNull(dblParam) Then
DblToForm = ""
Else
DblToForm = CStr(dblParam)
End If
End Function
Function IntToForm (ByVal intParam)
If IsNull(intParam) Then
IntToForm = ""
Else
IntToForm = CStr(intParam)
End If
End Function
Function LngToForm (ByVal lngParam)
If IsNull(lngParam) Then
LngToForm = ""
Else
LngToForm = CStr(lngParam)
End If
End Function
Function StrToForm (ByVal strParam)
If strParam = "" Or IsNull(strParam) Then
StrToForm = ""
Else
StrToForm = Replace(Server.HTMLEncode(strParam), """", """)
End If
End Function
' ============================================================
' ============================================================
Function FormToBool (ByVal strParam)
If strParam = "" Or IsNull(strParam) Then
FormToBool = false
Else
FormToBool = strParam <> "0" And strParam <> ""
End If
End Function
Function FormToDbl (ByVal strParam)
If strParam = "" Or IsNull(strParam) Then
FormToDbl = Null
Else
FormToDbl = CDbl(strParam)
End If
End Function
Function FormToInt (ByVal strParam)
If strParam = "" Or IsNull(strParam) Then
FormToInt = Null
Else
'txtLog "FormToInt(" & strparam & ") asc(" & asc(strparam) & ")"
FormToInt = CLng(strParam)
End If
End Function
Function FormToLng (ByVal strParam)
If strParam = "" Or IsNull(strParam) Then
FormToLng = Null
Else
FormToLng = CLng(strParam)
End If
End Function
Function FormToStr (ByVal strParam)
If strParam = "" Or IsNull(strParam) Then
FormToStr = Null
Else
FormToStr = strParam
End If
End Function
Function FormToDate (ByVal strParam)
If strParam = "" Or IsNull(strParam) Then
FormToDate = Null
Else
FormToDate = CDate(strParam)
End If
End Function
Function FormToDateByParam(ByVal strParam,ByVal strFormat)
If strParam = "" Or IsNull(strParam) Then
FormToDateByParam = Null
Else
If strFormat="DD-MM-YYYY" Then
FormToDateByParam = DateSerial(Mid(strParam,7,4),Mid(strParam,4,2),Left(StrParam,2))
Else
FormToDateByParam = CDate(strParam)
End If
End If
End Function
'=======================================================
Function BoolToHTML (ByVal blnParam)
If IsNull(blnParam) Then
BoolToHTML = ""
Else
BoolToHTML = CStr(blnParam)
End If
End Function
Function DblToHTML (ByVal dblParam)
If IsNull(dblParam) Then
DblToHTML = ""
Else
DblToHTML = CStr(dblParam)
End If
End Function
Function IntToHTML (ByVal intParam)
If IsNull(intParam) Then
IntToHTML = ""
Else
IntToHTML = CStr(intParam)
End If
End Function
Function LngToHTML (ByVal lngParam)
If IsNull(lngParam) Then
LngToHTML = ""
Else
LngToHTML = CStr(lngParam)
End If
End Function
Function StrToHTML(ByVal strParam)
If IsNull(strParam) Then
StrToHTML = ""
Else
StrToHTML = Replace(Replace(Replace(Server.HTMLEncode(strParam), """", """), vbCrLf, "<br>"), " "," ")
End If
End Function
'=======================================================
'=======================================================
Function BoolToUrl (ByVal blnParam)
If IsNull(blnParam) Then
BoolToUrl = ""
Else
If blnParam Then
BoolToUrl = "1"
Else
BoolToUrl = "0"
End if
End If
End Function
Function DblToUrl (ByVal dblParam)
If IsNull(dblParam) Then
DblToUrl = ""
Else
DblToUrl = Server.URLEncode(CStr(dblParam))
End If
End Function
Function IntToUrl (ByVal intParam)
If IsNull(intParam) Then
IntToUrl = ""
Else
IntToUrl = Server.URLEncode(Cstr(intParam))
End If
End Function
Function LngToUrl (ByVal lngParam)
If IsNull(lngParam) Then
LngToUrl = ""
Else
LngToUrl = Server.URLEncode(Cstr(lngParam))
End If
End Function
Function StrToUrl (ByVal strParam)
If strParam = "" Or isNull(strParam) Then
StrToUrl = ""
Else
StrToUrl = Server.URLEncode(strParam)
End If
End Function
Function DateToUrl (ByVal strParam)
If strParam = "" Or isNull(strParam) Then
DateToUrl = ""
Else
DateToUrl = Server.URLEncode(strParam)
End If
End Function
'=======================================================
Function BoolToInt (ByVal blnParam)
If blnParam Then
BoolToInt = 1
Else
BoolToInt = 0
End If
End Function
Function BoolToStr (ByVal blnParam)
If blnParam Then
BoolToStr = "true"
Else
BoolToStr = "false"
End If
End Function
Function StrToBool(ByVal strParam)
If LCase(strParam) = "true" Then
StrToBool = True
Else
StrToBool = False
End If
End Function
Function CStrNull (ByVal Param)
If IsNull(Param) Then
CStrNull = Null
Else
CStrNull = CStr(Param)
End If
End Function
Function CIntNull (ByVal Param)
'txtLog("CintNull(" & Param & ")")
If IsNull(Param) Then
CIntNull = Null
Else
CIntNull = CLng(Param)
End If
End Function
'======================================================
Function OraWeekdayToVBWeekday(ByVal intDay)
OraWeekdayToVBWeekday = (intDay - 1 + c_intWeekdayOffset) mod 7 + 1
End Function
Function StrToXML(ByVal strParam)
dim str
If Not IsNull(strParam) Then
str = Replace(str,"&","&")
str = Replace(str,"<","<")
str = Replace(str,">",">")
str = Replace(str,"'","'")
str = Replace(str,"""",""")
StrToXML = str
txtLog "post: " & str
End If
End Function
Function StrToJScript(ByVal str)
If Not IsNull(str) Then
StrToJscript = Replace(str,"\","\\")
StrToJscript = Replace(StrToJscript,"'","\u0027")
StrToJscript = Replace(StrToJscript,"""","\u0022")
StrToJscript = Replace(StrToJscript,vbTab,"\u0009")
StrToJscript = Replace(StrToJscript,vbVerticalTab,"\u000B")
StrToJscript = Replace(StrToJscript,vbCrlf,"<br>")
StrToJscript = Replace(StrToJscript,vbFormFeed,"\u000C")
else
StrToJscript = ""
End If
End Function
Function BoolToJScript(ByVal bln)
If bln Then
BoolToJScript = "true"
Else
BoolToJScript = "false"
End If
End Function
Function IntToJScript(ByVal intParam)
If IsNull(intParam) Then
IntToJScript = "null"
Else
IntToJScript = intParam
End If
End Function
Function CInt0(ByVal str)
If Not IsNull(str) Then
CInt0 = CLng(str)
Else
CInt0 = 0
End If
End Function
Function StrToInt(ByVal strParam)
If Trim(strParam) = "" Or IsNull(strParam) Then
StrToInt = Null
Else
StrToInt = CLng(strParam)
End If
End Function
Function IntToStr(ByVal intParam)
If IsNull(intParam) Then
IntToStr = Null
Else
IntToStr = CStr(intParam)
End If
End Function
Function StrToXLS(ByVal strParam)
Dim str
If Not IsNull(strParam) Then
str = Left(strParam, c_MaxCharXlsCell)
str = Replace(str, vbCrlf, " ")
str = Server.HTMLEncode(str)
'om de foutmelding "te veel celgegevens in excel" te voorkomen (treedt op bij teksten met meer dan 1024 karakters die beginnen met {+,-,=}) plaatsen we een html spatie voor de tekst
If Len(str)>1024 And (Left(str,1) = "-" Or Left(str,1) = "+" Or Left(str,1) = "=") Then
str = " " & str
End If
StrToXLS = str
End If
End Function
Function DblToXLS(ByVal strParam)
If Not IsNull(strParam) Then
DblToXLS = Replace(strParam,".",",")
End If
End Function
Function DateToXLS(ByVal strParam)
If Not IsNull(strParam) Then
DateToXLS = strParam - DateSerial(1900,1,1) + 2
End If
End Function
Function StrToTA(ByVal strParam)
If Not IsNull(strParam) Then
StrToTA = Replace(strParam,"<br>","#")
End If
End Function
%>