sqlclr编写的存储过程,在Management Studio里执行正常,但在ASP.NET里执行失败。为什么?源代码和错误信息如下:源代码:
Option Explicit On
Option Compare Text
Option Strict OffImports System
Imports System.Data
Imports System.Data.SqlTypes
Imports System.Data.SqlClient
Imports Microsoft.SqlServer.ServerPublic Class SqlCLRLib
<Microsoft.SqlServer.Server.SqlProcedure()> _
Public Shared Sub ExecuteSql(theSql As String)
Dim ComdStr As String = ""
ComdStr = CStr(theSql)
Using oConn As SqlConnection = New SqlConnection("context connection = true")
Using oComd As SqlCommand = New SqlCommand(ComdStr, oConn)
oConn.Open()
SqlContext.Pipe.ExecuteAndSend(oComd)
End Using
End Using
End Sub
End Class
错误信息:
在执行用户定义例程或聚合 "udf_ExecuteProcedure" 期间出现 .NET Framework 错误: 
System.Data.SqlClient.SqlException: 在执行用户定义例程或聚合 "udp_ExecuteSql" 期间出现 .NET Framework 错误: 
System.NullReferenceException: Object reference not set to an instance of an object.
System.NullReferenceException: 
   at SqlCLRLib.ExecuteSql(String theSql)