I'm just starting with using the SQLCLR features in SSX, and I'm following the most recent Beta 2 MSDN docs. I created an SQL Server project and made a simple stored procedure method, and the problem now is the docs refer to SqlContext.GetCommand( ) inside the stored procedure method to return an SqlCommand object, but this method does not exist.
I did some searches and noticed that the MSDN docs still refer to the old System.Data.SqlServer namespace where it has been replaced by Microsoft.SqlServer.Server in Beta 2.In the latest CTP (April), the server side provider has been merged with the client side, so you no longer reference sqlaccess.dll.
In addition you no longer do SqlContext.Connection/Command etc., but you get your connection through:
SqlConnection conn = new SqlConnection("Context Connection=true");
subsequently you get create your command as you'd have done in a client app:
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
or:
SqlCommand cmd = conn.CreateCommand():
You use the SqlContext to get your Pipe object and for the TransactionContext etc.
Hope this helps!!
Niels|||Thanks. I've been looking for that. Is there a page/blog where I can see all those updates to the API?|||Pablo Castro (PM at MS) wrote a MSDN article about it here.
A couple of blogs that cover this stuff is mine and Bob Beauchemins. Pablo and his team at MS also has a blog which is worth following.
Friday, March 9, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment