Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. EXECUTING VB.NET DLL

EXECUTING VB.NET DLL

Scheduled Pinned Locked Moved Database
csharpdatabasesharepointsql-server
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    ps_prakash02
    wrote on last edited by
    #1

    Hi, I've created a dll in visual basic.net 2005. i want to call the dll in my sql server 2005 stored procedure. (note sql server 2005 is upgraded from sql server 2000) so its not supporting creating assembly in sql server 2005. my vb.net code, Imports System Imports System.Reflection Imports System.IO <assembly: System.Reflection.AssemblyKeyFile("getpsftpkey.snk")> <assembly: AssemblyVersion("1.0.0")> Namespace nscreatetxt Public Class clscreatetxt Public Sub New() End Sub 'New Public Sub createtxt() Dim SW As StreamWriter SW = File.CreateText("\\file1\softusers\ps_prakash\MyTextFile.txt") SW.WriteLine("Hello Mom") SW.WriteLine("Hello GrandMom") SW.Close() End Sub 'createtxt End Class 'clscreatetxt End Namespace 'nscreatetxt my stored procedure code: -- Scratch variables used in the script DECLARE @retVal INT DECLARE @comHandle INT DECLARE @errorSource VARCHAR(8000) DECLARE @errorDescription VARCHAR(8000) DECLARE @retString VARCHAR(100) ---2146232576 -- Initialize the COM component. EXEC @retVal = sp_OACreate '{3045481F-66C0-3EE5-BE5C-2DA49E90AFCA}', @comHandle OUTPUT print @retVal IF (@retVal <> 0) BEGIN -- Trap errors if any EXEC sp_OAGetErrorInfo @comHandle, @errorSource OUTPUT, @errorDescription OUTPUT SELECT [Error Source] = @errorSource, [Description] = @errorDescription RETURN END -- Release the reference to the COM object EXEC sp_OADestroy @comHandle i created the dll, generated strong name, registered in gac and using regasm i registered in registry after that i executed the above sql statements its returning some negative value. my questions is 1) can i call a dll (which is created in visual studio 2005) inside a stored procedure of sql server 2005 2) can i use sp_oacreate procedures in sql server 2005 3) send me detail code how to dll in sql server 2005 stored procedures Thanks & Regards, P.Prakash

    M 1 Reply Last reply
    0
    • P ps_prakash02

      Hi, I've created a dll in visual basic.net 2005. i want to call the dll in my sql server 2005 stored procedure. (note sql server 2005 is upgraded from sql server 2000) so its not supporting creating assembly in sql server 2005. my vb.net code, Imports System Imports System.Reflection Imports System.IO <assembly: System.Reflection.AssemblyKeyFile("getpsftpkey.snk")> <assembly: AssemblyVersion("1.0.0")> Namespace nscreatetxt Public Class clscreatetxt Public Sub New() End Sub 'New Public Sub createtxt() Dim SW As StreamWriter SW = File.CreateText("\\file1\softusers\ps_prakash\MyTextFile.txt") SW.WriteLine("Hello Mom") SW.WriteLine("Hello GrandMom") SW.Close() End Sub 'createtxt End Class 'clscreatetxt End Namespace 'nscreatetxt my stored procedure code: -- Scratch variables used in the script DECLARE @retVal INT DECLARE @comHandle INT DECLARE @errorSource VARCHAR(8000) DECLARE @errorDescription VARCHAR(8000) DECLARE @retString VARCHAR(100) ---2146232576 -- Initialize the COM component. EXEC @retVal = sp_OACreate '{3045481F-66C0-3EE5-BE5C-2DA49E90AFCA}', @comHandle OUTPUT print @retVal IF (@retVal <> 0) BEGIN -- Trap errors if any EXEC sp_OAGetErrorInfo @comHandle, @errorSource OUTPUT, @errorDescription OUTPUT SELECT [Error Source] = @errorSource, [Description] = @errorDescription RETURN END -- Release the reference to the COM object EXEC sp_OADestroy @comHandle i created the dll, generated strong name, registered in gac and using regasm i registered in registry after that i executed the above sql statements its returning some negative value. my questions is 1) can i call a dll (which is created in visual studio 2005) inside a stored procedure of sql server 2005 2) can i use sp_oacreate procedures in sql server 2005 3) send me detail code how to dll in sql server 2005 stored procedures Thanks & Regards, P.Prakash

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      San_Sadhan wrote:

      can i call a dll (which is created in visual studio 2005) inside a stored procedure of sql server 2005

      Do you know what a SQL Server is? :doh:

      Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      P 1 Reply Last reply
      0
      • M Manas Bhardwaj

        San_Sadhan wrote:

        can i call a dll (which is created in visual studio 2005) inside a stored procedure of sql server 2005

        Do you know what a SQL Server is? :doh:

        Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

        P Offline
        P Offline
        ps_prakash02
        wrote on last edited by
        #3

        Hi, Thanks for ur reply. i dont know much sql server but my higher official want like that. could you please explain me, what exactly your trying to say. is that method is wrong or i dont want to this thing in sql server. sorry for late response. Regards, P.Prakash.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups