Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

72 строки
2.6KB

  1. ' Run with 32-bit and 64-bit cscript.exe to verify actual .mdb capability.
  2. ' Creates and removes a small temporary .mdb; it never touches campaign data.
  3. Option Explicit
  4. Dim fso, hostPath, providers, provider
  5. Set fso = CreateObject("Scripting.FileSystemObject")
  6. hostPath = WScript.FullName
  7. providers = Array("Microsoft.Jet.OLEDB.4.0", "Microsoft.ACE.OLEDB.12.0", "Microsoft.ACE.OLEDB.16.0")
  8. WScript.Echo "Script host: " & hostPath
  9. For Each provider In providers
  10. ProbeProvider CStr(provider)
  11. Next
  12. Sub ProbeProvider(providerName)
  13. Dim testPath, catalog, connection, recordset, errorText, okay
  14. testPath = fso.BuildPath(fso.GetSpecialFolder(2), _
  15. "MassMailer_" & fso.GetBaseName(fso.GetTempName()) & ".mdb")
  16. okay = False
  17. errorText = ""
  18. On Error Resume Next
  19. Set catalog = CreateObject("ADOX.Catalog")
  20. If Err.Number <> 0 Then
  21. errorText = Err.Description
  22. Err.Clear
  23. Else
  24. catalog.Create "Provider=" & providerName & ";Data Source=" & testPath & _
  25. ";Jet OLEDB:Engine Type=5;"
  26. If Err.Number <> 0 Then
  27. errorText = Err.Description
  28. Err.Clear
  29. Else
  30. Set catalog = Nothing
  31. Set connection = CreateObject("ADODB.Connection")
  32. connection.Open "Provider=" & providerName & ";Data Source=" & testPath & ";"
  33. If Err.Number <> 0 Then
  34. errorText = Err.Description
  35. Err.Clear
  36. Else
  37. connection.Execute "CREATE TABLE Probe (Id INTEGER)"
  38. connection.Execute "INSERT INTO Probe (Id) VALUES (1)"
  39. Set recordset = connection.Execute("SELECT Id FROM Probe")
  40. If Err.Number <> 0 Then
  41. errorText = Err.Description
  42. Err.Clear
  43. ElseIf recordset.EOF Then
  44. errorText = "Readback returned no rows"
  45. ElseIf CLng(recordset.Fields("Id").Value) <> 1 Then
  46. errorText = "Readback returned wrong value"
  47. Else
  48. okay = True
  49. End If
  50. End If
  51. End If
  52. End If
  53. If Not recordset Is Nothing Then recordset.Close
  54. If Not connection Is Nothing Then connection.Close
  55. Set recordset = Nothing
  56. Set connection = Nothing
  57. Set catalog = Nothing
  58. If fso.FileExists(testPath) Then fso.DeleteFile testPath, True
  59. On Error GoTo 0
  60. If okay Then
  61. WScript.Echo providerName & ": OK (create/write/read .mdb)"
  62. Else
  63. WScript.Echo providerName & ": UNAVAILABLE (" & errorText & ")"
  64. End If
  65. End Sub

Powered by TurnKey Linux.