Dave Balzer

Confessions of a Webgypsy

<January 2009>
SuMoTuWeThFrSa
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567


Navigation

Blog Roll

Subscriptions

Post Categories



Wednesday, June 15, 2005 - Posts

SqlDateTime Overflow Error

<note to self>

I have run into this problem a few times, but for some reason can never seem to remember the resolution.  Therefore I decided to note it here for future reference.

When trying to insert a null value for a nullable datetime field in sql 2K, I end up getting the SqlDateTime Overflow error.  This appears to be a problem with a difference between the definition of the Date and Datetime datatypes in .net and sql2K. 

The way I found to solve this (there may be better and I would love to hear if there are) is:

if myDate = DateTime.MinValue then
    myParamater.Value = System.DBNull.Value
else
    myParamater.Value = myDate
end if

Please weigh in if you have any additional insight or a better solution, but this does seem to work.

</note to self>

posted Wednesday, June 15, 2005 12:49 PM by dbalzer with 3 Comments

Fire Your Clients! FIRE THEM ALL!!!
Eric Wise posts a great article on firing your clients.  I really love his take on this.  I could have used his advice before venturing down the road of full time consultant myself.  I have had nearly every one of these clients and have made all the mistakes that enable them to be the way they are.  Thanks Eric for this insightful article.

posted Wednesday, June 15, 2005 5:26 AM by dbalzer with 0 Comments




Powered by Dot Net Junkies, by Telligent Systems