Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Call a method of an ActiveX object in T-SQL

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-07-09 : 08:07:42
Jim writes "Hello,

I want to be able to execute a method of a class object in a VB ActiveX DLL from a trigger in SQL Server (Version 7 or higher). I have checked out the 'sp_addextendedproc' command but this seems to be for Non ActiveX DLL's. I don't need to pass the method any parameters, but this would also be useful in the future.

Thanks."

MakeYourDaddyProud

184 Posts

Posted - 2002-07-09 : 08:30:42
Can you post some more information on what youre trying to do. I'm pretty sure this is not possible outside of the limits imposed by running application components in an extended SP. What is the DLL trying to do? You may be able to acheive your objective with less grief!

Daniel Small MIAP
www.danielsmall.com IT Factoring
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-07-09 : 09:06:32
Look in Books Online for the sp_OACreate and sp_OAMethod system procedures, they are designed to allow COM object usage in T-SQL procedures. You can use them without needing to write an extended stored procedure.

Here's an example that uses them to provide FTP functions:

http://www.sqlteam.com/item.asp?ItemID=6002

Go to Top of Page

knuckles
Starting Member

1 Post

Posted - 2002-07-09 : 20:31:53
Thanks for the replies,

I found the package robvolk described and had a go at it, It worked well, but My DLL's are registered through MTS and expect some of that functionality so they wouldn't instantiate under SQL Server (at least I think that why it wouldnt instantiate).

I don't think I would use that package except with ActiveX EXE's. I wouldn't want my code to bring down SQL Server.

Thanks.


Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-07-09 : 20:54:28
Did you register your DLL's on the SQL Server with regsvr32? I'm pretty sure you'll need to do that before you can use sp_OA procedures.

Unless you are a hideously sloppy coder, like me, I don't think your DLLs will crash SQL Server unless you deliberately made them buggy. It's very hard to do this in VB too, so you're probably safe.

The ActiveX EXE files may also work using sp_OA, but I've never tried it. Chadmat would be able to say for sure.

Go to Top of Page
   

- Advertisement -