Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 17th, 2008, 12:24 AM
Registered User
 
Join Date: Mar 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default CLR using Threads & context connection=true

Hi

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.GetCu rrentContext() at Microsoft.SqlServer.Server.SqlContext.get_CurrentC ontext() at Microsoft.SqlServer.Server.SqlContext.get_Pipe() at hiqidty4.hiqidty4.Identify_Search(Object identifyin)

Atleast i want to open connection object referring to "context connection = true", any suggestions on the same will be appreciated.

Let me know if i am missing any more here

Thanks in advance





Similar Threads
Thread Thread Starter Forum Replies Last Post
Page.ClientScript.RegisterStartupScript & Threads VerbatimBOT ASP.NET 2.0 Professional 0 July 23rd, 2008 05:39 AM
Unable to set context in web.xml or context.xml. dchicks Apache Tomcat 1 March 7th, 2008 07:59 AM
mysql & php connection problem. Manu Sharma PHP Databases 2 March 2nd, 2007 07:03 AM
Problems with threads. Threads disappearing? DriesNeyrinck VB.NET 0 June 10th, 2003 08:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.