|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Friday, June 29, 2012 9:34 AM
Points: 11,
Visits: 64
|
|
I built a simple method sending an ADODB recordset via MSMQ and successfully tested in a console app, but when I import into sql server2005 CLR and exectue I get an error.
-- Send object (all code works except this line):
[SqlProcedure] public static void Send(SqlString queue, SqlString point, SqlString bodynumber, out SqlString msg) { ADODB.Recordset rs = new ADODB.Recordset(); - call causing error
} // end Send
-- sql code create assembly SqlMSMQtools authorization dbo from 'C:\temp\SqlMSMQtools.dll' with permission_set = unsafe go
-- proc create PROCEDURE usp_MSMQ_SendAP46 @queue nvarchar(500), @point nvarchar(100), @body_number nvarchar(10), @msg nvarchar(MAX) output AS EXTERNAL NAME SqlMSMQtools.[SqlMSMQtools.Basic].Send GO
-- execute DECLARE @test nvarchar(1024) EXEC usp_MSMQ_SendAP46 @queue='FormatName:DIRECT=TCP:1.2.3.4\\private$\\XXX', @point='TestPoint',@body_number='123456', @msg = @test OUTPUT select @test
-- error Msg 6522, Level 16, State 1, Procedure usp_MSMQ_SendAP46, Line 0 A .NET Framework error occurred during execution of user defined routine or aggregate 'usp_MSMQ_SendAP46': System.UriFormatException: Invalid URI: The URI is empty. System.UriFormatException: at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) at System.ComponentModel.Design.RuntimeLicenseContext.GetLocalPath(String fileName) at System.ComponentModel.Design.RuntimeLicenseContext.GetSavedLicenseKey(Type type, Assembly resourceAssembly) at System.ComponentModel.LicenseManager.LicenseInteropHelper.GetCurrentContextInfo(Int32& fDesignTime, IntPtr& bstrKey, RuntimeTypeHandle rth) at SqlMSMQtools.Basic.Send(SqlString queue, SqlString point, SqlString bodynumber, SqlString& msg)
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Sunday, November 04, 2012 12:23 PM
Points: 2,087,
Visits: 3,932
|
|
Hi
Question: Why do you use ADODB instead of ADO.NET?
Could you please wrap your code with the following exception handler and post the result. Maybe this helps to find the problem: [code="csharp"] try { //////////////////////////////////////// // YOUR CODE int i = int.Parse("blah"); //////////////////////////////////////// } catch (Exception ex) { System.IO.StringWriter sw = new System.IO.StringWriter();
sw.WriteLine("======================================"); sw.WriteLine("Exception"); sw.WriteLine("Type: {0}", ex.GetType()); sw.WriteLine("Message: {0}", ex.Message);
Exception e = ex.InnerException; while (e != null) { sw.WriteLine(); sw.WriteLine("-------------------------"); sw.WriteLine("Inner Exception"); sw.WriteLine("Type: {0}", e.GetType()); sw.WriteLine("Message: {1}", e.Message);
e = e.InnerException; }
System.Diagnostics.StackTrace stack;
stack = new System.Diagnostics.StackTrace(ex, true); sw.WriteLine(); sw.WriteLine("-------------------------"); sw.WriteLine("Target"); for (int i = stack.FrameCount - 1; i >= 0; i--) { System.Diagnostics.StackFrame frame = stack.GetFrame(i); sw.WriteLine("({0}) :: {1} | File(Line:Column): {2} ({3}:{4})", (frame.GetMethod().DeclaringType == null ? "<UNKNOWN>" : frame.GetMethod().DeclaringType.ToString()), frame.GetMethod().ToString(), string.IsNullOrEmpty(frame.GetFileName()) ? "<UNKNOWN>" : frame.GetFileName(), frame.GetFileLineNumber(), frame.GetFileColumnNumber()); }
stack = new System.Diagnostics.StackTrace(1, true); sw.WriteLine(); sw.WriteLine("-------------------------"); sw.WriteLine("Origin"); for (int i = 0; i < stack.FrameCount; i++) { System.Diagnostics.StackFrame frame = stack.GetFrame(i); sw.WriteLine("({0}) :: {1} | File(Line:Column): {2} ({3}:{4})", (frame.GetMethod().DeclaringType == null ? "<UNKNOWN>" : frame.GetMethod().DeclaringType.ToString()), frame.GetMethod().ToString(), string.IsNullOrEmpty(frame.GetFileName()) ? "<UNKNOWN>" : frame.GetFileName(), frame.GetFileLineNumber(), frame.GetFileColumnNumber()); }
SqlContext.Pipe.Send(sw.GetStringBuilder().ToString()); } [/code]
Thanks Flo
The more I learn, the more I know what I do not know Blog: Things about Software Architecture, .NET development and T-SQL
How to Post Data/Code to get the best Help How to Post Performance Problems
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: Wednesday, June 12, 2013 11:17 AM
Points: 9,855,
Visits: 9,376
|
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Today @ 5:23 AM
Points: 96,
Visits: 7,200
|
|
Hi did beyonder422 did you ever get a solution to this problem. I am having the exact same problem and can't find any information about it on Google.
Thanks
4x4 photos
|
|
|
|