Option Explicit Const DSN = "Driver={MySQL ODBC 5.1 Driver};Uid=root;Pwd=*****;Server=localhost;Database=test;OPTION=1 + 2 + 8 + 32 + 16384 + 8388608" Const adStateClosed = 0 Const adStateOpen = 1 Const adStateConnecting = 2 Const adStateExecuting = 4 Const adStateFetching = 8 Const adApproxPosition = 4000 Const adOpenForwardOnly = 0 Const adOpenKeyset = 1 Const adOpenDynamic = 2 Const adOpenStatic = 3 Const adOpenUnspecified = -1 Const adUseNone = 1 Const adUseServer = 2 Const adUseClient = 3 Const adLockReadOnly = 1 Const adLockPessimistic = 2 Const adLockOptimistic = 3 '---- ParameterDirectionEnum Values ---- Const adParamUnknown = &H0000 Const adParamInput = &H0001 Const adParamOutput = &H0002 Const adParamInputOutput = &H0003 Const adParamReturnValue = &H0004 '---- CommandTypeEnum Values ---- Const adCmdUnknown = &H0008 Const adCmdText = &H0001 Const adCmdTable = &H0002 Const adCmdStoredProc = &H0004 Const adCmdFile = &H0100 Const adCmdTableDirect = &H0200 Const adInteger=3 Const adDate=7 Const adVarChar=200 Dim cnxDatabase Dim strSQL ' connecting database Set cnxDatabase = CreateObject("ADODB.Connection") cnxDatabase.Open(DSN) cnxDatabase.Execute "drop table if exists bug11525" cnxDatabase.Execute "create table bug11525(x SERIAL, VCField VARCHAR(30) DEFAULT NULL, DtField DATE DEFAULT NULL)" ' querying data strSQL = "SELECT * FROM bug11525" Dim rs Set rs = CreateObject("ADODB.Recordset") With rs .ActiveConnection = cnxDatabase .LockType = adLockOptimistic '3 .CursorType = 2 'adOpenStatic 3, adOpenKeyset 1, 2 adOpenDynamic .CursorLocation = 3 '3 adUseClient '1 adUseServer .Open(strSQL) End With rs.AddNew rs("x") = 0 rs("VCField") = "Test" rs("DtField") = date rs.Update rs.AddNew rs("x") = 0 rs("VCField") = "Test1" rs.Update rs.AddNew rs("x") = 0 rs("VCField") = "Test2" rs("DtField") = date rs.Update If rs.State = adStateOpen Then WScript.Echo ("Closing RS") rs.Close End If If rs.State = adStateOpen Then WScript.Echo ("RS NOT closed!") End If WScript.Echo ("Done 1") With rs .ActiveConnection = cnxDatabase .LockType = adLockOptimistic '3 .CursorType = 2 'adOpenStatic 3, adOpenKeyset 1, 2 adOpenDynamic .CursorLocation = 3 '3 adUseClient '1 adUseServer .Open(strSQL) End With rs.MoveFirst if rs.Supports(adApproxPosition)=true then response.write("Supports RC") end if WScript.Echo ("RC: " & rs.RecordCount) WScript.Echo("== " & VarType(rs("DtField")) & " ==") WScript.Echo(" Type " & TypeName(rs("DtField"))) if IsNULL(rs(2)) Then WScript.Echo ("DtField is NULL") else WScript.Echo ("DtField val: " & rs(2)) end if WScript.Echo ("Done 2") 'NULL in Date field rs.MoveNext if IsNULL(rs(2)) Then WScript.Echo ("DtField is NULL") else WScript.Echo ("DtField val: " & rs(2)) end if WScript.Echo ("Done 3") cnxDatabase.Execute "drop table if exists bug11525" Set rs = Nothing Set cnxDatabase = Nothing