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”
Category: SQL Server 7
.NET – Write A File to Disk from your Database
In this example I will review and give examples in C# and VB.NET how to get and save a file stored in an Image datatype in a SQL Server table.
Here is a link to a list of other articles I have written about using .NET with SQL Server. Continue reading “.NET – Write A File to Disk from your Database”
ASP.NET – Handling Null Return Values from the Database using IsDBNull
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
If you find this article useful, have a look at some of the other ASP.NET tips and tricks articles I’ve published. Continue reading “ASP.NET – Handling Null Return Values from the Database using IsDBNull”