Random thoughts of wisdom - the personal blog of Michael Holm Andersen

Microsoft Virtual Academy–free learning from Microsoft Experts

This is mostly related to those of my students who are interested in learning Microsoft technologies: Take a look at the Microsoft Virtual Academy which offers “Free Microsoft Training Delivered by Experts” as stated on the website: This site includes 100s o... [More]

Free eBook from Microsoft - Introducing Windows Server 2012

Microsoft of course would like us all to upgrade to Server 2012 as soon as possible, so they have released a free eBook about the newest edition of Windows Server. The book is available in PDF, MOBI and EPUB: [More]

InvalidCastException on linq DB submit with non-integer key – aka LinqToSQL bug

Wasted a whole day on a (confirmed) bug in LinqToSQL. The problem is this: “When database contains two tables, both with automatic integer primary keys, and a relationship between a unique char field in one and a non-unique char field in the other, inserting new rows into the second table fails on ... [More]

Setting DataContext Connection String at runtime

I’m working on a portal/e-shop solution where I’ll be using multiple databases and needs to change the Connection used by my DataContext object at runtime. I use the HttpContext.Current.Items collection to store which connection is currently “active” - this is setup in the Application_AcquireReques... [More]

LINQtoSQL Samples

If you’re looking for some great LINQtoSQL samples look no further than MSDN. As part of the 101 LINQ samples project, Microsoft has put together some nice LINQtoSQL samples – take a look at: (101 samples with download link) http://msdn.mi... [More]

MS SQL Server 2008 Express (x64) memory leak?

I’ve been using MS SQL Server 2008 Express edition (x64) on Vista Ultimate SP2 quite a lot the last month and was running out of memory almost every day (the SQL Engine using +1GB of Memory!!) Today I updated my SQL Instance to SQL Server 2008 Service Pack 1 and now it only uses between 100-150MB o... [More]

SQL Azure Manager

If you’re into SQL Azure you have probably found out that SSMS is not fully compliant with SQL Azure, which means that you more-or-less have to use SQLCMD to do any real work (which kind of sucks!) Today, however I discovered SQL Azure Manager which is a lightweight tool for managing SQL Azure data... [More]

GridView and the RowCommand event

The GridView is a powerful control, however dealing with multiple different column types in the RowCommand event still is a little messy! – I’ve put together a small sample which utilize the most common column types. I have a GridView which looks like this: <asp:GridView ID="GridView1"... [More]

SQL Injection Attack - once again...

As you might have read in the news, Denmark is currently the target of Injection Attacks which mostly is a problem with pourly programmed websites - if you're worried about wether your website is up to the task of rejecting these attacks .. take a look at this article which explains the pro... [More]

Left Outer Join using LINQ

Often we need to do a left/right outer join. A friend of mine asked me how to do this using LINQ - and the short answer is this: from s in Suppliers     join c in Customers on s.City equals c.City into temp     from t in temp.DefaultIfEmpty()     ... [More]