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
 Development Tools
 Other Development Tools
 Accessing Visual Basic Functions From SQL

Author  Topic 

samtoffa
Yak Posting Veteran

60 Posts

Posted - 2005-01-06 : 18:18:25
I want to use some of my previous VB functions from SQL statements, e.g. SELECT MyFunction(Field_1) FROM AnyTable.
I've been trying to create DLL's in VB to use as Extended Stored Procedures in SQL. The DLL's work fine in VB programs when I use them to instantiate objects, e.g. Dim X as New MyClass
However the functions don't seem to be accessible when I try to use the DLLs as Extended Stored Procedures. Error message says 'cant find entry point for MyFunction...etc' so I guess the functions are not being exported properly.
Any advice please....other than using C++ or C !!!
Cheers,
Sam

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-01-06 : 19:45:54
Do you mind if I ask what MyFunction is returning? what kind of "work" is it doing? can it be rewritten in T-SQL? or is it tranforming or looking up values based on a parameter passed in? (If so -- you should never do this with a function in SQL, use joins)

- Jeff
Go to Top of Page

samtoffa
Yak Posting Veteran

60 Posts

Posted - 2005-01-07 : 05:05:10
The function is an encryption function that takes two strings as parameters and returns an encrypted string. I can't write it in T-SQL because it requires direct memory manipulation.
I just need to know how to export the functions from a DLL in VB.
Sam
Go to Top of Page

samtoffa
Yak Posting Veteran

60 Posts

Posted - 2005-01-07 : 10:56:07
*********** SOLVED !!! ***************

I Used:

sp_OACreate (DLL_Name.Class_Name)

Not easy to find, but it's all there in BOL
Go to Top of Page
   

- Advertisement -