Last post Jul 01, 2007 08:36 AM by mbanavige
Jun 30, 2007 10:29 PM|bmains|LINK
I want to store a TimeSpan in the database, which the DAAB Database object is used to pass the TimeSpan to the database. What is the DBType and the underlying database type in SQL Server 2005 (is it datetime?)?
Jul 01, 2007 08:36 AM|mbanavige|LINK
A TimeSpan represent the difference between 2 different points in time so it is actually just a number and not a datetime.
One of the constructors for the TimeSpan structure takes a Long (Int64) which represents Ticks. So if you store a TimeSpans Ticks value in your database, then you
will be able to recreate that timespan object. The Int64 type can be stored in SQL2005 using a bigint Type (here's the mapping between .NET Types and SQL Types)