Archive for the ‘Development Playground’ Category

T-SQL regular expressions on MS SQL 2005

Tuesday, April 29th, 2008

One of the most anticipated features of SQL Server 2005 is the integration of the .Net CLR into the SQL Server engine. This article is going how write .Net code and use it in SQL Server 2005. As an example I am going to write a function for regular expression search.

SQL Server 2005 hosts the .Net CLR and will load and execute DLLs, which can also be referred to as assemblies. Assemblies maybe created in C# or VB.Net.
(more…)

Truncate time part of DateTime in T-SQL

Thursday, April 3rd, 2008

Often you may want to query an SQL table in MS SQL Server where there has been data entered by using getdate(). Getdate() will store the data like the resut of the follwing T-SQL statement.

SELECT GetDate()
GO
(more…)

101 LINQ Samples

Thursday, March 20th, 2008

As you know we recently started using Microsoft latest technology LINQ. Here (101 Linq Samples) is the good set of samples for every day use.
For example “Partitioning Operators” samples are very interesting. They are very useful for pagination of results and the best part pagination done on sql server. (more…)

Javascript Alert Message

Wednesday, March 19th, 2008

How to show javascript alert message from code behind? You probably know, we can do it like this:
ClientScript.RegisterStartupScript(Page, “message”, “alert(’Hellow world!’);”, true).

However this method is not going to work in AJAX environment. For AJAX you need to use: ScriptManager.RegisterStartupScript.

Here is a little utility method, which displays javascript alert message both in AJAX environment and on regular page:
(more…)

Server side thumbnail generation

Saturday, March 15th, 2008

I was creating virtual tour page for one of our new projects and I faced a problem of creating thumbnails on a fly. Usually

image galleries are done in flash and we (asp.net developers) doesn’t face this problem, however this project had requirement that was easier to implement with asp.net.

Below is the code for ImageThumbnail.aspx.cs, which does server side resizing:
(more…)