December 16, 2009 at 4:53 am
Hello ,
I m using following link to create assembly and stored proc using c#.net
http://social.msdn.microsoft.com/Forums/en/sqlnetfx/thread/53dc2eb9-f077-4043-9f76-a0460c1f9332
I have c#.net class library project which uses MATLAB dll as my external dll . I have to use matlab dll for few calculation. Matlab dll is strong name dll and properly versioned.
Code.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Server;
using MathWorks.MATLAB.NET.Arrays;
namespace Test_Wit_Strong_Name
{
public class Sp1
{
[Microsoft.SqlServer.Server.SqlProcedure]
public static void Add_Two_Numbers(int a, int b)
{
SqlPipe pipe = SqlContext.Pipe;
test_sum.majid_class test =new test_sum.majid_class();
//test_sum.majid_class test = (test_sum.majid_class)Activator.CreateInstance(typeof(test_sum.majid_class));
double[] a1 = new double[1] { a };
double[] b1 = new double[1] { b };
MWNumericArray mwnA = new MWNumericArray(a1);
MWNumericArray mwnB = new MWNumericArray(b1);
String Sum = Convert.ToString(test.majid_sum(mwnA, mwnB));
pipe.Send(Sum);
}
[Microsoft.SqlServer.Server.SqlProcedure]
public static void Square(int a)
{
SqlPipe pipe;
pipe = SqlContext.Pipe;
/* Test 1 without Matlab */
int result = a * a;
pipe.Send(result.ToString());
}
}
}
I have two functions Square, Add_Two_Numbers . when i tested only for square function, assembly and procedure created properly .because it does not have matlab instance in it. (here I need to hide Add_Two_Numbers function fron class )
But when I m trying for Add_Two_Numbers and executing following statemnt in query analyser.
CREATE ASSEMBLY assembly1 FROM 'C:\MatlabTest\Test_Wit_Strong_Name\Test_Wit_Strong_Name\bin\Debug\Test_Wit_Strong_Name.dll'
WITH PERMISSION_SET = UNSAFE --EXTERNAL_ACCESS
It throws me error like
Msg 6586, Level 16, State 1, Line 2
Assembly 'System.Drawing' could not be installed because existing policy would keep it from being used.
Can you please help me to create stored procedure from class libaray which have matlab function as external dll.
Many Thanks
Majidkhan
December 21, 2009 at 10:18 am
I think that this thread (http://www.sqlservercentral.com/Forums/Topic649184-386-1.aspx) explains the problem.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy