SQL Server 2005, .NET Assemblies, and WordML
If you listened to the pod cast I did for Office Zealot last week, I was asked what kinds of technologies I am really into right now. I responded that I am eager to explore the possibilities of SQL 2005 XML and XML in Office. For example, using the enhanced SQL XML features to produce WordProcessingML documents or document fragments. There is much to do in this area.
Well, I have been experimenting with creating .NET assemblies for SQL Server 2005. It's cool. Basically, you create a typical class library, but (in Beta 2) you reference sqlaccess.dll assembly for the SqlServer namespace. You can now write db-connected code without having to set up the connection and so forth. You get it for "free" when you configure the assembly in SQL Server 2005. Why? Because, when you add the assembly to SQL 2005, your code runs in the context of the database where it is loaded. So, when I spin up a SqlCommand object, the connection is all dialed up for me:
SqlPipe myPipe=SqlContext.GetPipe();
SqlConnection cnn = SqlContext.GetConnection();
SqlCommand cmd = SqlContext.GetCommand();
cmd.CommandText = "SELECT FirstName, LastName FROM PolicyHolder";
cmd.CommandType =
CommandType.Text;
SqlDataReader reader = cmd.ExecuteReader();
myPipe.Send(reader);
You see that I got a connection, but it is in the context of my database connection on the server (because, after all, the assembly is running on the server).
I learned today from this blog entry that in SQL 2005 Beta 3, they are merging the SqlServer and SqlClient libs. Thus, you will be able to write code to work with data and toggle a setting to determine if the connection is explicit or implicit. That's actually pretty slick- although I have questions about some of the context around transactions.
Rock Thought for the Day: I mentioned a few days ago about how conventional so much music is. Fortunately, there are always a few glimmers of hope. One band that has my attention is the A-Frames with their new Sub Pop release Black Forest. It's an unpredictable album and reminds me very much of early early punk, but not exactly. In any case, it's noisy, and I would have appreciated it if not every riff was so out-of-balance. That said, it's an interesting album that goes in unexpected yet decidedly not haphazard directions. Thank heavens someone is!
Rock On
Comments
- Anonymous
June 08, 2009
PingBack from http://hairgrowthproducts.info/story.php?id=860