Accessing. NET components from SQL Server

Source: Internet
Author: User

From: http://www.sqljunkies.com/Tutorial/C5A500EB-B8BE-42C0-B23B-258A342CAAAB.scuk

In the articles titled using COM objects in SQL Server and extending SQL Server with COM objects, we saw
Basics of how to access and use COM objects from SQL Server. with the advent. net, it is natural for us to see If SQL server can call. net objects. unfortunately, you cannot, as described in the following article. but don't lose heart, you can access. net objects in an indirect way using an intermediate com wrapper. this COM Wrapper can call into. net code using InterOP. in this example, we will see how to exploit this feature.

The steps for accessing. Net objects from SQL Server is quite straightforward. The following are the steps:

    • Create the. NET class by defining an interface and having a. Net class implement the interface.
    • Generate a strong name for the assembly using the SN tool and add the relevant Assembly attributes.
    • compile the Assembly and use the regasm tool to generate the Type Library for the Assembly and register the same.
    • run the gacutil program to register this Assembly in the GAC.
    • write the Visual Basic 6 DLL wrapper over this. Net assembly by adding the appropriate references.
    • compile this DLL and place it in some folder.
    • write the SQL Server CILS for this VB 6 DLL. This in turn invokes the. NET dll which returns the result.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.