Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 .NET Inside SQL Server (2005)
 CLR using Threads & context connection=true

Author  Topic 

adi_sesha
Starting Member

1 Post

Posted - 2008-03-15 : 06:51:18
Hi
I have small issue in using "context connection =true", googled a lot could not find sol other than relevant query at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=334494&SiteID=1

I have a DLL deployed in SQL2005 which uses Thread pool. Since DLL exists in DB we can directly access it using context connection = true.

In my case the following works fine, if i execute the same out side Threadpool

SqlCommand cmd = new SqlCommand("select 1...", connection);
SqlContext.Pipe.ExecuteAndSend(cmd);

When i execute inside threadpool, either by passing opened connection object, or tried to open connection to "context connection = true" i am getting following error.

System.InvalidOperationException: The requested operation requires a Sql Server execution thread. The current thread was started by user code or other non-Sql Server engine code. at Microsoft.SqlServer.Server.SmiContextFactory.GetCurrentContext() at Microsoft.SqlServer.Server.SqlContext.get_CurrentContext() at Microsoft.SqlServer.Server.SqlContext.get_Pipe() at hiqidty4.hiqidty4.Identify_Search(Object identifyin)

Let me know if i am missing any more here

Thanks in advance
   

- Advertisement -