I had a strange problem getting data from a database and its correct type using VBScript for ASP.
I have a recordset obtained using the following function:
Public Function vfuncGetRS(strQuery)
'Returns a disconnected paging capable recordset
'Note - Non Windows servers don't support disconnected recordsets so you'll always get a connected recordset on
' a non Windows server!
On Error Resume Next
Err.Clear
Dim objData
Set objData = Server.CreateObject("ADODB.Recordset")
objData.CursorLocation = adUseClient
objData.CursorType = adOpenStatic
objData.LockType = adLockReadOnly
objData.Open vlogSQLFilter(strQuery), objDB
If Not blnUNIXMode Then
Set objData.ActiveConnection = Nothing
End If
Set vfuncGetRS = objData
End Function
If I select a value from the recordset and get it VarType, it will return the value 16, for example.
Set objRS = vfuncGetRS("SELECT * FROM SOME_TABLE")
Response.Write(VarType(objRS("someColumn")))
Strangeness is in two parts
- This ONLY happens on a specific server, this code is part of the CMS that I deploy to multiple sites, and only the instance running in IIS 6.0 causes me a problem. It also depends on the parameters of the recordset.
- A value of 16 is not a valid value for VarType to return according to the official MSDN link
, , ,
If VarType(strValue) = 16 Then strValue = CInt(strValue)
, , , , VarType 16, IsNumeric() false, ( )
, : - , ?