Accessing .Net components from SQL Server..

  • Thread starter Thread starter H S
  • Start date Start date
H

H S

Hi all,
Has anybody tried doing this?? I followed this article to the T, but still
have problems in the last step..
When I try the last step (as shown below) I get a "Invalid Class String"
....this tells me for some reason my VB6 wrapper didnt get registered..
I tried physically registering it and it shows up in the registry.

Any and all help appreciated!

Thanks
HS


DECLARE @comHandle INT
DECLARE @retVal INT
DECLARE @errorSource VARCHAR(100)
DECLARE @errorDescription VARCHAR(100)
DECLARE @helloString VARCHAR(200)

EXEC @retVal = sp_OACreate 'HelloDNA.Class1', @comHandle OUTPUT
IF (@retVal <> 0)
BEGIN
EXEC sp_OAGetErrorInfo @comHandle, @errorSource OUTPUT, @errorDescription
OUTPUT
SELECT @errorSource, @errorDescription
END


http://www.sqljunkies.com/Article/C5A500EB-B8BE-42C0-B23B-258A342CAAAB.scuk
 
* "H S said:
Has anybody tried doing this?? I followed this article to the T, but still
have problems in the last step..
When I try the last step (as shown below) I get a "Invalid Class String"
...this tells me for some reason my VB6 wrapper didnt get registered..
I tried physically registering it and it shows up in the registry.

Are you sure you are talking about VB.NET? If not, consider turning to
one of the microsoft.public.vb.* groups.
 
Look in microsoft.public.sqlserver.programming for the thread "Using DLL's".
The answer is basically, "don't do it".

In summary, accessing a DotNet assembly from SQL Server is possible but
also:

1. not simple
2. not supported
3. dangerous

HTH,
Bob
 
It looks like the article you refer to was written more recently than when I
last looked into the matter, so maybe it's OK to do, sorry I don't have any
specific advice on the problem you're having since I won't test it. Just
remember (you probably know this already) that you can crash SQL Server
itself if your DLL throws any unhandled exceptions; considering what you're
trying to do (regardless of method) is essentially a hack, I wanted to relay
to you a Word Of Caution.

Bob

H S said:
Yes Herfried : I am talking about VB.Net classes. Here's the article that
describes how to do it.
http://www.sqljunkies.com/Article/C5A500EB-B8BE-42C0-B23B-258A342CAAAB.scuk

Bob: Looking at the article I thought it was pretty staright forward..
Is there another way of doing this or that I can't use DLLs in SQL server
at all?? This doesn't seem plausible.

Thanks
HS
 
Back
Top