Home All Groups Group Topic Archive Search About

VS2005, C#, DataBinding of SqlServer 2K TimeStamp datatype

Author
2 Feb 2006 1:35 PM
ESmith
Newbie Warning!

There, out with the full disclosure.

I have a datatable with a variable "CreationDate" of type TimeStamp.

I'm trying to learning Data Binding, when I drag the table onto my Windows
Form (2.0) and try to compile, I get an error about incompatible type
conversions.

What I want to happen is to have the TimeStamp displayed as a Date on my
form (read-only, not updateable).
How do I need to configure the databinding so that a TimeStamp (byte[]) is
converted properly?

TIA

Author
3 Feb 2006 4:10 PM
Cowboy (Gregory A. Beamer) - MVP
SQL Server Timestamps are not dates, no matter how you slice them. They are
an internal structure that guarantee a changed row is flagged:
http://www.sqlteam.com/item.asp?ItemID=1410

If you want a date, redesign to be a date (or add an additional date column).

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************


Show quote
"ESmith" wrote:

> Newbie Warning!
>
> There, out with the full disclosure.
>
> I have a datatable with a variable "CreationDate" of type TimeStamp.
>
> I'm trying to learning Data Binding, when I drag the table onto my Windows
> Form (2.0) and try to compile, I get an error about incompatible type
> conversions.
>
> What I want to happen is to have the TimeStamp displayed as a Date on my
> form (read-only, not updateable).
> How do I need to configure the databinding so that a TimeStamp (byte[]) is
> converted properly?
>
> TIA
>
>
>
Author
4 Feb 2006 8:15 PM
William (Bill) Vaughn
IMHO there is a bug in the way that data columns are bound and managed in
the DataGridView... Yes, a TimeStamp isn't really a time (it used to be in
ages past) but it (along with other binary datatypes) aren't handled
correctly in the DataGridView. You'll need to hide the column (users should
never see or set this) or handle the DataError event...

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Show quote
"ESmith" <eliana_sm***@hotmail.com> wrote in message
news:euU551$JGHA.2900@TK2MSFTNGP14.phx.gbl...
> Newbie Warning!
>
> There, out with the full disclosure.
>
> I have a datatable with a variable "CreationDate" of type TimeStamp.
>
> I'm trying to learning Data Binding, when I drag the table onto my Windows
> Form (2.0) and try to compile, I get an error about incompatible type
> conversions.
>
> What I want to happen is to have the TimeStamp displayed as a Date on my
> form (read-only, not updateable).
> How do I need to configure the databinding so that a TimeStamp (byte[]) is
> converted properly?
>
> TIA
>

AddThis Social Bookmark Button