This handy-dandy T-SQL query will take any input string and capitalize the start of each word within the string. It will also enforce proper use of lower-case throughout the string without affecting query performance too severely. This query assumes that you are working with titles, user names, or place names where you want to make sure that the first letter of each word is capitalized. Continue reading “T-SQL to Enforce Proper Case Capitalization”→
If you are retrieving or adding values from and to your database then you will know the difficulties that can be caused by NULL values. The notorious InvalidCastException is one example of receiving a NULL value from your database into an ASP.NET object that doesn’t know what to do with database NULL values.
Here’s typical example of an InvalidCastException error caused by setting a String variable to a value that is returned as a NULL from your database query:
System.InvalidCastException: Conversion from type 'DBNull' to type 'String' is not valid. at Microsoft.VisualBasic.CompilerServices.Conversions.ToString(Object Value) at ASP.myPageName_aspx.Page_Load(Object sender, EventArgs e) in D:\Inetpub\wwwroot\MySite\myPageName.aspx:line 1xx