使用此代码:
Dim xmlDOM
Set xmlDOM = Server.CreateObject("MSXML2.DOMDocument.3.0")
如何测试CreateObject函数是否成功?
答案 0 :(得分:4)
如果它不起作用,您可能会收到错误消息。否则,您可以使用以下代码:
Dim xmlDOM
'dont fail on error'
On Error Resume Next
Set xmlDOM = Server.CreateObject("MSXML2.DOMDocument.3.0")
On Error GoTo 0 'turn error handling off again'
If Not xmlDOM Is Nothing Then
'not null: it worked'
Else
'xmlDOM is nothing. It was not able to create the object. '
'Check create permissions in COM+'
End If