SQL to Linq to XML

OK, so just about everyone reading this post will be aware of LINQ, if not you can checkout that link, another great place is that man, ScottGu's blog.

Anyway, I found myself with a spare few minutes (hence this post) which was largely due to how quick LINQ dealt with my small and simple task.  I wanted to read user data out of a database and create a new XML file with that data (there is some stuff to go on after that but unless LINQ can compress and email files its use ends here!) 

There is nothing out of the ordinary for creating an XML file, we could do it a couple of ways; pass in a SQL expression or call a sproc, read into a dataset via a dataadapter for example and dump that out to an XML file would probably be the easiest but not without problems and/or pains.

But how about this....

image

Wow! Well I was impressed!!  LINQ is just fantastic to use. 

Note: I did obviously need to create my dbml file which was just a case of dragging the object on from the server explorer.

I am currently working on a few little/simple apps, trying out new technologies, I have a silverlight "drawing pad" app which I will blog soon (I left it on my lappy which is currently being fixed :( )  Getting there! :)

Print | posted on Sunday, August 5, 2007 9:41 PM

Feedback

No comments posted yet.

Your comment:





 
 

Copyright © Steve Clements

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski