PC Review


Reply
Thread Tools Rate Thread

Displaying SQL Timestamp in a Datagrid

 
 
Nathan Waddington
Guest
Posts: n/a
 
      1st Feb 2005
Hello,

When I try to display a SQL Timestamp type in a datagrid I get the
following output: System.Byte[]

Is there any way to show the timestamp that the Timestamp type holds?
Cheers,
Nathan.

 
Reply With Quote
 
 
 
 
Mary Chipman
Guest
Posts: n/a
 
      1st Feb 2005
The timestamp data type is an automatically generated binary number
which is guaranteed to be unique within the database, nothing more. It
has nothing to do with the datetime data type. It is used mainly where
there are text or image columns so that the server can determine
whether a row has been updated without having to actually load the
text or image. Is there a reason why you feel you need to display this
value? Normally it is used for comparison, where you compare the value
of a fetched timestamp in a dataset row with the value that is
currently in the database.

--Mary

On 1 Feb 2005 11:19:25 -0800, "Nathan Waddington"
<(E-Mail Removed)> wrote:

>Hello,
>
>When I try to display a SQL Timestamp type in a datagrid I get the
>following output: System.Byte[]
>
>Is there any way to show the timestamp that the Timestamp type holds?
>Cheers,
>Nathan.


 
Reply With Quote
 
Nathan Waddington
Guest
Posts: n/a
 
      1st Feb 2005
Hello Mary,

Thanks for the info, I want to display the data as I thought it was
actually a timestamp. I want a timestamp, I'd like to know when the
record was last updated. It seems like I need to build some triggers
in order to set a datetime on insert and update to achieve what I want
then. Although the actual use of Timestamp is intriguing and I will
have to look into it further.

Thanks again,
Nathan.

 
Reply With Quote
 
=?Utf-8?B?QnJpYW4gQnJvd24=?=
Guest
Posts: n/a
 
      1st Feb 2005
Hi Nathan,

All you have to do to accomplish this is add a date field to the table and
set the default of the field to the GetDate() function. Now every time there
is an insert the date will be populated for you.

I hope this helps.
------------------------------------

 
Reply With Quote
 
Mary Chipman
Guest
Posts: n/a
 
      2nd Feb 2005
If you want to see the actual date and time the data was updated, then
yes, you will need to add a trigger to handle this. If you don't like
the idea of a trigger, an alternative would be to code all of your
update code in parameterized stored procedures where the stored
procedure adds the datetime value as part of the update. You then need
to disallow direct data entry into the table, and code your
application to use only the update stored procedure.

--Mary

On 1 Feb 2005 12:47:55 -0800, "Nathan Waddington"
<(E-Mail Removed)> wrote:

>Hello Mary,
>
>Thanks for the info, I want to display the data as I thought it was
>actually a timestamp. I want a timestamp, I'd like to know when the
>record was last updated. It seems like I need to build some triggers
>in order to set a datetime on insert and update to achieve what I want
>then. Although the actual use of Timestamp is intriguing and I will
>have to look into it further.
>
>Thanks again,
>Nathan.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
All Outlook Clients displaying wrong 'received' timestamp. Erik Microsoft Outlook Discussion 6 12th May 2008 03:25 PM
DataGrid timestamp column Sgt. Sausage Microsoft Dot NET Framework Forms 0 15th May 2005 01:25 PM
timestamp in datagrid Balint Toth Microsoft ADO .NET 0 13th May 2004 01:59 PM
displaying sybase timestamp Shawn Microsoft ASP .NET 1 27th Jan 2004 01:23 PM
DataGrid Component | Displaying columns of a DataSet as Rows in a DataGrid ? Diego TERCERO Microsoft C# .NET 3 19th Dec 2003 02:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:52 PM.