简体   繁体   中英

Can't Create ActiveX Control

Working on getting a legacy app up and running again for work. I'm getting an error at run time that I can't create an activeX control. The suspect call is

oSQL = CreateObject("SQLDMO.SQLServer2")

I did a bit of googling and found that SQLDMO should be in a SQLDMO.dll. I've got that DLL referenced in my project but it is still failing. Any ideas?

Thanks, Mike

Calling createobject bypasses your project references, so you have a choice, you can try to create the instance with the 'new' operator, or continue using create object.

I'd advise against CreateObject.
Create object will look up that libraryName.objectName from the registry, debugging problems there is difficult.

Ps the dll must be registered with regsvr32

Pps beware 64bit processes calling 32bit dlls, they will always fail

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM