Exporting SQL Query Results to a CSV file using SQLCMD and C#

Today a colleague asked me how to export SQL Query Results to a CSV file. This got me thinking that it would be a nice exercise to do this from a C# application. So to start off, I downloaded the correct AdventureWorks database for my version of SQL from the…

Continue ReadingExporting SQL Query Results to a CSV file using SQLCMD and C#

C# Programming – Caller Information Attributes

Okay, so I don’t have a specific series for this and seeing as this is more of a programming tip, I’ll leave it out of the Visual Studio 2012 Tips series. Caller Information Attributes are a very useful and probably underutilized feature implemented in the C#5.0 Compiler. Caller Information Attributes allow you to see how  your method was called. So forget having to sift through the stack trace in order to achieve diagnostic level logging, use Caller Information Attributes instead. (more…)

Continue ReadingC# Programming – Caller Information Attributes

Why I Fall In Love With Code Each And Every Day

You know that feeling when you are in the groove, and the code just flows?  You might be listening to music (Pink Floyd or Ahmad Jamal is my code music) or sitting in complete silence. You might code to Slayer blasting in your ears or flourish in the hum drum of the office din. Whatever your thing is, we can all agree that there is no better place than that place…. your comfort coding zone. (more…)

Continue ReadingWhy I Fall In Love With Code Each And Every Day

Typical Developer’s Life… in GIF’s (How you feel when…)

Typical Developer's Life - I really enjoy these GIF's that illustrate a different meaning than the original scene they were taken from. I decided to create a few myself, just for the fun of it. If you know of some really funny ones, let us know in the comments. Also…

Continue ReadingTypical Developer’s Life… in GIF’s (How you feel when…)

Debugging Windows Services using an #if Directive

Debugging Windows Services – I love writing them. In fact, to encompass a unit of functionality in a self contained bit of code is incredibly powerful. That is, if it is written correctly. I think it is something we as programmers take a bit for granted. One thing I know, is that debugging a Windows Service is one of the most painful things ever. Give it a try… Create a Windows Service in Visual Studio (I’m using Visual Studio Ultimate 2012), start it in debug mode and take a gander at the error message you get.

(more…)

Continue ReadingDebugging Windows Services using an #if Directive

Backwards Compatibility of SQL Server Management Objects (SMO)

Visual Studio Add Reference SMORecently I had an issue where a Web Application stopped working when a SQL Server Migration took place. The SQL Server was moved to a new physical server, but in addition to that they upgraded SQL Server from 2005 to 2008 R2. The problem turned out to be the SMO references in the source code. All applications written referencing previous versions of SMO need to be changed to reference the new SMO DLL’s.

(more…)

Continue ReadingBackwards Compatibility of SQL Server Management Objects (SMO)

Calling a .NET DLL From VBScript

Visual Studio 2012 New Class Library ProjectRecently I have had to call a .NET Dll from a VBScript. Why would I need to do this I hear you ask? Well sometimes it is easier to do certain things in .NET or you might have previously written functionality in a .NET DLL that you now need to duplicate in the VBScript. That was what I was faced with. I didn’t want to have to re-write code, and I make no excuses for being lazy. So I decided to try and find a way to call a .NET DLL from a VBScript.

This turned out to be much easier than I had initially thought. In order to illustrate this, fire up Visual Studio and create a new Class Library Project.

(more…)

Continue ReadingCalling a .NET DLL From VBScript

Import Application Option missing in IIS Manager

Default Web Site

 

With the release of Visual Studio 2010 came support to package up your ASP.NET Web Application. This also packages dependencies like the web.config, databases etc. An administrator can then import the created package via the Import Application option in IIS Manager. When I first read about this option, I thought it was the best thing since sliced bread. To access the Import Applications option, select the Default Web Site node under your server name.

The only problem was that the Import Application option was missing from the Actions pane in my IIS Manager. (more…)

Continue ReadingImport Application Option missing in IIS Manager

Add External Tools (All-In-One Code Framework v4) to Visual Studio 2010

Today saw the All-In-One Code Framework Sample Browser updated to Version 4. I have to say, that I really love the look and feel of this latest version. Now while I know that there is a Sample Browser Visual Studio Extension for 2010, I feel that version 4 looks nicer and I wanted to have it available inside Visual Studio 2010. To enable this, follow these steps:

Step 1

From the Toolbar, select the Tools menu item.

(more…)

Continue ReadingAdd External Tools (All-In-One Code Framework v4) to Visual Studio 2010