Hi,
I'm new to Integration services and .Net programming but am trying to
create a dll that I can access from Sql server 2005.
The dll read's an xml file and carries out some processing. I've run
the code as an console app and it works fine.
I have created the assembly in sqlserver thus:
create assembly PinCodeLoader from
'C:\PinCodeLoader\PinCodeLoader\PinCodeLoader\bin\Debug\PinCodeLoader.dll'
with permission_set = external_access
But when I try to reference the assembly from a stored proc
create procedure dbo.interface_processPinCodefile(@.filename
nvarchar(1024))
as EXTERNAL name PinCodeLoader.PinCodeloader.Main
I get the following error:
Msg 6505, Level 16, State 1, Procedure interface_processPinCodefile,
Line 3
Could not find Type 'PinCodeloader' in assembly 'PinCodeLoader'.
I understand the context of the syntax should be
assembly_name.class_name.method_name. The first lines of the code in
the DLL are as follows
namespace PinCodeLoader
{
class PinCodeLoader
{
static void Main(string[] args)
{
Therefore assembly = PinCodeLoader, class_name = PinCodeLoader and
method_name = Main. Which should equal
EXTERNAL name PinCodeLoader.PinCodeloader.Main, I thought.
Has anybody come across this or can they offer any assistance?
Many thanks,
Paul
Hi, try to compile the .vb file with this command line:
csc.exe /t:library PinCodeLoader.bv (Put the correct name of the .vb file)
If this work look at the properties of the project and search for 'root namespace' (or something similar), and delete it, then try again compiling the entire solution from de IDE...
Good luck
Alejandro F.
|||
You need to include the namespace as well:
create procedure dbo.interface_processPinCodefile(@.filename
nvarchar(1024))
as EXTERNAL name PinCodeLoader.[PinCodeLoader.PinCodeloader].Main
However, you still won't be able to create your proc because SQL can't map nvarchar(1024) to the string array args.
|||Thanks for your replies guys. I didn't actually try that method but found a way around it.
In my c# program I removed the reference to a namespace, as I was told it's not really necessary and changed the code as follows.
public class PinCodeLoad
{
public static void Main(string filename,string datasource,Int32 timeout, string companyname)
{
So instead of using the args parameter I'm implictly defining them. Plus I preceded my class and method with public
I kept the stored proc as before.
I hope that helps anybody else.
Paul
No comments:
Post a Comment