Here I will post problems I and my colleagues met and solutions we found.

Thursday, January 17, 2008

Application.ThreadException Event is static

Today I had problems with handling exceptions in new application. Instead of showing message my application just terminated, and I couldn't find where.

The reason was that Application.ThreadException Event is static event, but handler I assigned to it was not static method. I didn't get any warnings, it just didn't work.

Extracting Date from DateTime in MS SQL

I don't know may be you know better way of extracting Date from DateTime in MS SQL, but the one I like is

DATEADD(d, 0, DATEDIFF(d, 0, [DateTime Column]))

Using conversion would be converting datetime to number, then to integer, then back to date. I didn't measure performance, but don't see much problems with arithmetic.