I have two functions in a .DLL created in VB6 I want to use.
I create two Extended Stored Procedures using:
sp_addextendedproc 'MyFunctionA', 'MyFunctions.dll'
sp_addextendedproc 'MyFunctionB', 'MyFunctions.dll'
When I run:
EXECUTE @ReturnValue = MyFunctionA @Paramate1
I get:
"Cannot find the function MyFunctionA in the library C:\Program Files\MyDLLs\MyFunctions.dll. Reason: 127(The specified procedure could not be found.)"
What am I missing

Extended Stored Procedures and VB
Rolandkline
Mercenary4
Hi,
I do not know Assembler (MASM, I Guess ), so I would not know. About an hour after you posted, someone answered my query. The answer is: You cannot do it in VB. You must use a lower level language like C, C++, or Delphi. If you want more info, you can view the answer at:
http://forums.microsoft.com/msdn/showpost.aspx postid=126929&siteid=1
Thanks for your help though.
Blue Eyes
I have tried this solution and it seems to be very easy to implement: sp_OACreate, sp_OAMethod, and sp_OADestroy. It also seems to be much faster than you indicated.
Thank you very much for your help!!!
Mr. Trevisan Andrea
Do you get the same with CREATE ASSEMBLY and CREATE PROC
CREATE ASSEMBLY ...
CREATE PROC ... AS EXTERNAL NAME ...
I guess I would not use MyFunctionA, not 'MyFunctionA', but I don't know if that matters.
sigmasoft
Talinu
Hi,
Unfortunately I cannot implement the VB Code using UDFs or SPs. The VB Code I wrote is simply a wrapper around another DLL to simplify the interface.
Unfortunatley, I'm sort of stuck using the VB Function directly inside of the SP. I did some more digging and found C++ has an Extended Stored Procedure Wizard.
I know it sounds a bit clugy, but can I use the Wizard to create a C++ Program, which is a wrapper around the VB Program, which is a wrapper around the DLL
Since I do not know C++, this might be the easier approach instead of rewriting VB in C++.
Books On-Line for SQL Server (Extended Stored Procedures >> Creating) gives some instructions, but it is confusing. The Example xp_hello may be helpful along with the other examples.
Thanks for your help!