[INCLUDE]

[CODE]
Public Function MySQL_EscapeVarValue(ByRef xValue As Variant, Optional ByVal xRaiseError As Boolean = True) As String
  Dim xDate1 As Date
  Dim xChar1 As String

  Select Case VarType(xValue)
    Case VbVarType.vbDate
      xChar1 = Right("000" + Year(xDate1), 4&) + _
               "-" + _
               Right("0" + Month(xDate1), 2&) + _
               "-" + _
               Right("0" + Day(xDate1), 2&) + _
               " " + _
               Right("00" + Hour(xDate1), 2&) + _
               ":" + _
               Right("0" + Minute(xDate1), 2&) + _
               ":" + _
               Right("0" + Day(xDate1), 2&)
      MySQL_EscapeVarValue = MySQL_EscapeValue(xChar1)
    Case VbVarType.vbBoolean
      MySQL_EscapeVarValue = CStr(-CLng(xValue))
    Case VbVarType.vbString
      MySQL_EscapeVarValue = MySQL_EscapeValue(xValue)
    Case VbVarType.vbError, _
         VbVarType.vbArray, _
         VbVarType.vbDataObject, _
         VbVarType.vbObject, _
         VbVarType.vbUserDefinedType
      If xRaiseError Then Error 13
    Case Else
      MySQL_EscapeVarValue = Trim(Str(xValue))
    End Select
  End Function