Thursday, September 11, 2008

My latest DotNetSlackers article was published today: Easy XML to SQl with Linq.

Transferring data between partner companies is pretty routine, and XML is one of the common formats that data are transferred in. One of the more common destinations for the XML data is a SQL Server database. In the past, XML was difficult to work with, but the .NET framework improved XML parsing greatly. Linq to XML has made XML handling absolutely painless, and Linq to SQL makes entering the data just as easy.

This example isn’t meant to say this is the only way to transform XML into SQL, because like all things .NET, there are several ways to do this. This method may or may not work depending on your circumstances.

This article is based on my real world experiences using Linq-to-SQL, Linq-to-XML and the XML extensions in VB.NET to rapidly develop transformations of XML data into SQL Server databases.  This is an extremely common scenario in many businesses, and I wanted to highlight how easy it is.

Thursday, September 11, 2008 9:51:02 PM (Eastern Standard Time, UTC-05:00)
 Tuesday, August 12, 2008

Old news by now, but SP1 is out with all sorts of glorious new features, except a good installation path.  If you have several machines to update with both VS2008 SP1 and .NET 3.5 SP1 (e.g., a team), you'll want the ISO file, which can be tricky to find.  Direct link to combined installer .iso.  And, I use the awesome freeware ImgBurn to create the disks for my team.

I've seen a couple reports that the installation takes 3+ hours, but all told installation for me went 45 minutes.  I cheated, and downloaded the .NET 3.5 SP1 first (full package at http://download.microsoft.com/download/2/0/e/20e90413-712f-438c-988e-fdaa79a8ac3d/dotnetfx35.exe), installed that, then ran the combo installer. 

Greg has a great list of VS2008 things to download (including the MSDN update and training pack) at http://coolthingoftheday.blogspot.com/2008/08/visual-studio-2008-net-35-sp1-etc.html.

As always, make sure to remove any previous betas of the SP (both .NET and VS) you have installed.  I had the SP beta installed, and got rid of it from Add/Remove programs before I installed anything.  If you have any hotfixes installed, you need to remove those as well.  This time, there's a hotfix removal tool.

Unlike Craig Shoemaker, I was not asked for the original media.  I installed the MSDN updates, too, which tool a little over 30 minutes themselves.  All told, you're investing a couple hours for a full update.

Tuesday, August 12, 2008 10:32:02 AM (Eastern Standard Time, UTC-05:00)
 Wednesday, January 23, 2008

Shiny new thing to eat up bandwidth!

I'm a solo developer in a corporate environment, so I'm really on my own to learn new things.  As good as blogs and books are, there's sometimes no substitute for being shown how.  That's why Microsoft highlights so many videos on its asp.net site.  ASP Alliance also has a growing library of videos.

Enter onto this list one more site--DotNetVideos.net.  Right now there are around 100 videos on a great number of topics.  Apparently there are a couple hundred more in the pipeline.  And, if you sign up now, you get 6 months of ASP.NET Pro magazine for free.  That alone is worth the sign-up.  ASP.NET Pro is one of my favorite trade mags (I have an online subscription, and have for several years).

When you're Googling for info on whatever you're working on, don't forget to check out this site, too, and see if someone is showing you how it's done.

Full disclosure: I was asked to say something about the new site, and I usually ignore such requests.  But after checking it it, it's one I'll be spending some time on, and recommending to others.

(edit - fixed links)

Wednesday, January 23, 2008 11:03:13 AM (Eastern Standard Time, UTC-05:00)
 Tuesday, December 18, 2007

If you've ever listened to Hanselminutes, you've no doubt heard Scott mention "code smell" or "pretty code".  The new language features in VB9, including LINQ and XML being a native type, make XML generation not only easy, but beautiful.  Aside from the color scheme, look at how smooth this code snippet is.

Dim _order As New XElement(<Order>
    <ShipperRef><%= h.UniqueRef %></ShipperRef>
    <UniqueRef><%= IIf(h.CustomerPo <> "", h.CustomerPo, h.JdeNumber) %></UniqueRef>
    <Comments><%= _orderComments %></Comments>
    <OrderType><%= h.OrderType %></OrderType>
    <Workflow><%= h.Workflow %></Workflow>
    <RORRelationship><%= h.RORRelationship %></RORRelationship>
    <Supplier><%= h.SupplierNumber.ToString %></Supplier>
    <Customer><%= h.Customer.ToString %></Customer>
    <FreightBillableParty><%= h.FreightBillableParty %></FreightBillableParty>
    <MethodOfPayment>Prepay</MethodOfPayment>
    <HAZMAT><%= h.Hazmat %></HAZMAT>
    <GroupAssignment><%= SetGroupAssignment(h.GroupAssignment) %></GroupAssignment>
    <Weight><%= _orderWeight.ToString %></Weight>
    <Volume><%= _orderCube.ToString %></Volume>
    <OrderContact><%= h.PrimaryContactAssignment %></OrderContact>
    <ShipmentContact><%= h.PrimaryContactAssignment %></ShipmentContact>
    </Order>)

My VS 2008 theme is DesertNights, and the code was copied with CopySourceAsHtml.

 |  |  | 
Tuesday, December 18, 2007 12:41:21 PM (Eastern Standard Time, UTC-05:00)