Articles written by Dave Howard

Presenting Leading Zeroes in a Query

Presenting Leading Zeroes in a Query This little tip came in handy for me when sorting objects by their position within a tree structure. If you build up a string such as 0.0.1.0 representing the nodes position within a tree structure then sorting will result in an ascii sort where 0.

Dave Howard - 1,307 views

XMLHTTPRequest in Stored Procedure

XMLHTTPRequest in Stored Procedure I recently had a requirement to call a webservice from a stored procedure. I looked into doing this by writing a CLR assembly in SQL 2005. There were a few articles online describing this but working in a large organisation I knew that getting the thi

Dave Howard - 16,787 views

Json converters lacking in Microsoft AJAX RTM

Json converters lacking in Microsoft AJAX RTM Having spent some time developing a project using a CTP version of Microsoft Ajax ("ATLAS" back in the day) I finally came to migrate the project to the RTM version. After uninstalling the CTP release, and installing the RTM release I wasn

Dave Howard - 4,877 views

Using Enum.Parse()

Using Enum.Parse() Have you ever written any code along the lines of... myEnum GetEnumValue(string EnumString) {     myEnum enumValue;     switch (EnumString)     { &n

Dave Howard - 25,254 views

Typed Masterpage reference

Typed Masterpage reference ASP.NET master pages are pretty handy and here is a simple tip to make them even easier to use. Using the MasterType reference in your content page allows you to refer to your master page properties without having to cast it to your master page type everytime.

Dave Howard - 9,536 views

How to add a Digg This counter to your article

How to add a Digg This counter to your article Simply by adding the HTML below to this page... <script> digg_url = 'http://digg.com/programming/How_to_add_a_Digg_This_link_to_your_web_site'; </script> <script src="http://digg.com/api/diggthis.js"

Dave Howard - 2,125 views

T-SQL script automatically adds auditing to a table

T-SQL script automatically adds auditing to a table The script below looks at the structure of the table you specify and creates a new table called xxx_Audit with the same structure plus a timestamp, less any constraints/unique keys etc. It then creates a new trigger on the original tabl

Dave Howard - 30,082 views

Select Column Information using SQL Server

Select Column Information using SQL Server Use this T-SQL to select infomation about a specific table/columns, Useful for automated scripts. DECLARE @tablename varchar(100) SET @tablename = N'myTable' SELECT clmns.name&n

Dave Howard - 152,491 views

Why we use C# for .NET development

Why we use C# for .NET development In the company where we work, we have a policy of using Java for all major developments. The core reason behind this being that we have a long term aspiration to being vendor and platform independent. Regards the .NET framework the policy is to

Dave Howard - 37,451 views

Bug in VS2005? Using Typed DataSets with SQL 2005 and stored procedures

Bug in VS2005? Using Typed DataSets with SQL 2005 and stored procedures I have been a fan of typed datasets since I started using them in VS2005. Using the feature with SQL Express/stored procedures, Express/SQL Statements, SQL Server/SQL Statements all generate my DAL just fine. However, I

Dave Howard - 10,017 views

Changing Schema for a group of objects

Changing Schema for a group of objects This script moves all of you stored procedures from one Schema to another. This was really handy when using a Typed Dataset with SQL 2005 and stored procedures. The wizard creates stored procedures in the users Schema (and complains if it does not e

Dave Howard - 11,279 views

Enabling Agent XPs on a new SQL Server 2005 install

Enabling Agent XPs on a new SQL Server 2005 install I had to do this prior to creating a maintainence plan for a database on my development box. When i first tried to create the plan I was given a message that Agent XPs are not enabled and that I should run sp_reconfigure. Run t

Dave Howard - 28,756 views

Should I use C# or VB .Net?

Should I use C# or VB .Net? What a conundrum, each developer has their favourite. In this article I will try to document the pro's and con's, or at least the differences of each language. I will admit that I am a C# developer but I will try to keep this unbiased. VB C#

Dave Howard - 1,453 views

Encoding string to Base64 / UTF8

Encoding string to Base64 / UTF8 Sometimes you need to convert strings to Base64, for example in security components. The function below does this: public string stringToBase64(string s) {     try     

Dave Howard - 20,551 views

Authenticated HTTPRequests (Using Credentials)

Authenticated HTTPRequests (Using Credentials) Recently I had to make a SOAP call to a Cisco CallManager (an IP PBX). This required that the request used basic authentication. I couldn't add a web reference as the cisco interface doesn't support GET requests, so the Visual Studio discovery

Dave Howard - 81,309 views

Lightweight Ajax

Lightweight Ajax Ajax doesn't have to be complicated - at its most basic it just means partial updates your pages rather than reloading the whole page. The attached js library contains just two functions - GetContent and RunJS. GetContent() takes a URL and a element name: It si

Dave Howard - 7,605 views

Web service calls from javascript using ATLAS (part 3) - Complex properties

Web service calls from javascript using ATLAS (part 3) - Complex properties Part two covered returning objects with multiple properties from a webservice and accessing those properties from javascript. This article demonstrates that even 'complex' properties are supported by the ATLAS

Dave Howard - 5,264 views

Web service calls from javascript using ATLAS (part 2) - Complex return types

Web service calls from javascript using ATLAS (part 2) - Complex return types Following on from part one which showed how to make web service calls from javscript, this article will now show the flexibility of the ATLAS framework by calling a web service that returns an object from jav

Dave Howard - 6,932 views

Web service calls from javascript using ATLAS (part 1)

Web service calls from javascript using ATLAS (part 1) ATLAS provides a fantastic mechanism for making web service calls from javascript code. Take the simple web service below... public class myWebService : System.Web.Services.WebServic

Dave Howard - 5,849 views

Auto-complete using ATLAS

Auto-complete using ATLAS Setting up an auto-complete input box in ATLAS is pretty simple, here is a quick guide to illustrate this... Assuming you already have the ATLAS framework referenced in your project then select an <asp:TextBox> to apply auto-complete to. See Mark

Dave Howard - 8,458 views

Strongly Typed Dataset doesn't always auto generate DELETE and UPDATE stored procedures

Strongly Typed Dataset doesn't always auto generate DELETE and UPDATE stored procedures I found this problem whilst creating a STD that included a many to many relationship between two tables. I created a table consisting of the two foreign keys and appropriate constraints to support t

Dave Howard - 7,164 views

Return new identity from Strongly Typed Dataset DataTable.Insert method

Return new identity from Strongly Typed Dataset DataTable.Insert method Datasets are pretty good at auto generating stored procedures and wrapping c# code around them for you. However with the insert method you often want to do something with the object that you have just inserte

Dave Howard - 26,291 views

Extending Strongly Typed Datasets

Extending Strongly Typed Datasets Strongly Typed Datasets are a rather nice addition to VS2005 (they don't lend themselves well to acronyms however) You still need to create a database and tables and realationships but using STDs saves a writing huge amount of code. If this code

Dave Howard - 6,156 views

Handling hierachical structures in SQL

Handling hierachical structures in SQL Dealing with tree structures in SQL can be tricky. A common solution is to have a self referencing table with a primary key and parent key column. This allows for any depth of tree and allows each 'node' to have zero or more child nodes. Be

Dave Howard - 5,053 views

Serializing abstract classes to XML

Serializing abstract classes to XML Digg it: http://digg.com/programming/Serializing_abstract_classes_to_XML_in_c It is often useful to have abstract classes with several derived types to allow use of strongly typed lists and the such. For example you might have a DocumentFragmen

Dave Howard - 21,642 views

Strongly Typed DataSets and GridViews

Strongly Typed DataSets and GridViews If you are anything like me you don't enjoy writing 5 or 6 stored procedures for each business object in your solution. If you do, then click here to read more about T-SQL! http://www.geekzilla.co.uk/Browse.aspx?CategoryID=32 For the re

Dave Howard - 9,523 views

Updating Foreign keys in a GridView

Updating Foreign keys in a GridView A GridView generally shows and allows the user to update rows in a database. They are easy to set up until the values that you want to update is a foreign key. Its not obvious how to send the appropriate value back to the database or how to

Dave Howard - 11,741 views

Garmin and Google Maps

Garmin and Google Maps The bought a Garmin Forerunner recently which is a really cool piece of kit but the maps that come with it are very poor. Google maps has an API that allows you to integrate these rich maps into your own web applications. Garmin has the option to export yo

Dave Howard - 13,320 views

Updating controls from another thread

Updating form controls from another thread. Form controls, by default, can only be updated by the forms thread. Otherwise an invoke must be used. The example below shows a simple logging function that can be called by threads other than the forms. delegate void LogSa

Dave Howard - 4,949 views

System tray and balloon tips

Balloon Tips from the System Tray You can really easily add system tray function to .NET windows forms by dragging the NotifyIcon object onto your form. You can then use this to display balloon tips from the system tray with the code below: myNotifyIcon.ShowBalloonTip(500,&nbs

Dave Howard - 30,349 views