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
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How to call Unmanaged Code from SQL CLR.

How to call Unmanaged Code from SQL CLR.

Scheduled Pinned Locked Moved Database
csharpdatabasesql-serverdotnetcom
2 Posts 2 Posters 0 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.
  • I Offline
    I Offline
    ivix4u
    wrote on last edited by
    #1

    I have written a C# dll which makes a call to some unmanaged code. When i tried to register this dll on SQL server 2005 i got the following error. Msg 6215, Level 16, State 1, Line 1 CREATE ASSEMBLY failed because method 'AddNumbers' on type 'Project1._Class1' in safe assembly 'Interop.Project1' has invalid attribute 0x1003. How do i register such a dll.

    M 1 Reply Last reply
    0
    • I ivix4u

      I have written a C# dll which makes a call to some unmanaged code. When i tried to register this dll on SQL server 2005 i got the following error. Msg 6215, Level 16, State 1, Line 1 CREATE ASSEMBLY failed because method 'AddNumbers' on type 'Project1._Class1' in safe assembly 'Interop.Project1' has invalid attribute 0x1003. How do i register such a dll.

      M Offline
      M Offline
      Mark J Miller
      wrote on last edited by
      #2

      You need to register the assembly as unsafe (project properties) and you'll need to configure SQL Server to allow unsafe assemblies (database must be marked as TRUSTWORTHY and you must have UNSAFE ASSEMBLY permissions). Everything you need to know should be in this article: http://www.codeproject.com/KB/database/SQLCLRIntegrationSecurity.aspx[^]

      Mark's blog: developMENTALmadness.blogspot.com

      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