问题描述
我遇到了一个错误,我无法弄清楚代码出了什么问题。当我尝试创建对象(objbl = CreateObject( SQLXMLBulkLoad.SQLXMLBulkload.4.0))时,就会发生这种情况。
I'm running into an error and I cannot figure out what's wrong with the code. It happens when I try to create an object (objbl = CreateObject("SQLXMLBulkLoad.SQLXMLBulkload.4.0")).
我错过了什么吗?
Try
objbl = CreateObject("SQLXMLBulkLoad.SQLXMLBulkload.4.0") // error happens on this line.
objbl.ConnectionString = ReadVariables("ConnectionString")
Console.WriteLine(objbl.connectionstring.ToString)
objbl.ErrorLogFile = workingdirectory & "\error.log"
objbl.TempFilePath = workingdirectory & "" 'workingdirectory
objbl.CheckConstraints = True
objbl.KeepIdentity = False
objbl.Transaction = True
'objbl()
Catch ex As System.Exception
Console.WriteLine("Error initializing SQL Bulk load object." & Chr(13) & Chr(10) & ex.ToString)
WritetxtToLog("Error initializing SQL Bulk load object." & Chr(13) & Chr(10) & ex.ToString, 1)
Exit Sub
End Try
这里是异常错误:
System.Exception被捕获
Message = Cannot创建ActiveX组件。
Source = Microsoft.VisualBasic
StackTrace:Microsoft.VisualBasic.Interaction.CreateObject(String ProgId,String ServerName)处的
在C中的XMLshredapp.XMLShredApp.InitBulkLoad() :\ShredApp\XMLshredapp\XMLShredApp.vb:行460
InnerException:
System.Exception was caught Message="Cannot create ActiveX component." Source="Microsoft.VisualBasic" StackTrace: at Microsoft.VisualBasic.Interaction.CreateObject(String ProgId, String ServerName) at XMLshredapp.XMLShredApp.InitBulkLoad() in C:\ShredApp\XMLshredapp\XMLShredApp.vb:line 460 InnerException:
推荐答案
这些错误 ActiveX不能创建对象通常意味着您提供给CreateObject的ProgID是未知的。
Those errors "ActiveX can not create object" generally mean that the ProgID you supplied to CreateObject is unknown.
换句话说,如果ProgID(SQLXMLBulkLoad.SQLXMLBulkload.4.0),则会出现此错误。输入错误或属于未在注册表中注册的DLL。
In other words, you get this error if the ProgID (SQLXMLBulkLoad.SQLXMLBulkload.4.0) was mistyped or belongs to a DLL that is not registered in the registry.
是否可以在运行此应用程序的计算机上搜索注册表,并查看SQLXMLBulkLoad是否存在在注册表中?如果没有,则需要找到该DLL并将其注册(使用)
Can you search the registry on the machine where you are running this application and see if the SQLXMLBulkLoad exists in the registry? if it does not, you need to find that DLL and register it (with regsvr32)
这篇关于无法创建Active X对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!