473,406 Members | 2,208 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

how do i get a SQL timestamp into/out of a grid?

i have a hidden template column that contains a label which is populated
with a SQL Timestamp. the problem is each time i bring the timestamp out it
is coming out as "System.Byte[]" which is just a string

i understand that the timestamp cannot be seen as its binary but what/how am
i meant to store it in within the grid and then return it out if the user
selects that particular record

ive just been using this to return other fields but that wont work for the
timestamp
myTimeStamp = CType(e.Item.Cells(5).Controls(1), Label).Text

anyone any idea's?

Cheers,
Craig
Nov 19 '05 #1
5 1345
The timestamp column is not really designed to be a human friendly field. It
is useful in concurrency management, if you design your own, and has other
uses, as well. If you want to display as a numeric value, try something like:

for(int i=timestamp.Length;i>0;i--)
{
result += (byt[i-1] * calc);
calc *= 256;
}

---

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

***************************
Think Outside the Box!
***************************
This will calculate the value of all of the bytes in the array. Then display
result.ToString();


"Craig G" wrote:
i have a hidden template column that contains a label which is populated
with a SQL Timestamp. the problem is each time i bring the timestamp out it
is coming out as "System.Byte[]" which is just a string

i understand that the timestamp cannot be seen as its binary but what/how am
i meant to store it in within the grid and then return it out if the user
selects that particular record

ive just been using this to return other fields but that wont work for the
timestamp
myTimeStamp = CType(e.Item.Cells(5).Controls(1), Label).Text

anyone any idea's?

Cheers,
Craig

Nov 19 '05 #2
'* store in field
CType(e.Item.Cells(5).Controls(1), Label).Text.Text =
System.ConvertToBase64String(myTimeStamp)

'* fetch from field
myTimeStamp = System.ConvertFromBase64(CType(e.Item.Cells(5).Con trols(1),
Label).Text)

-- bruce (sqlwork.com)

"Craig G" <craig.gamble@y_arrasoftware.com> wrote in message
news:OC**************@TK2MSFTNGP12.phx.gbl...
| i have a hidden template column that contains a label which is populated
| with a SQL Timestamp. the problem is each time i bring the timestamp out
it
| is coming out as "System.Byte[]" which is just a string
|
| i understand that the timestamp cannot be seen as its binary but what/how
am
| i meant to store it in within the grid and then return it out if the user
| selects that particular record
|
| ive just been using this to return other fields but that wont work for the
| timestamp
| myTimeStamp = CType(e.Item.Cells(5).Controls(1), Label).Text
|
| anyone any idea's?
|
| Cheers,
| Craig
|
|
Nov 19 '05 #3
"The timestamp column is not really designed to be a human friendly field" -
i doubt they could make it anymore unfriendly!!
anyhow, when i do the following i get an error saying - Value of type
'String' cannot be converted to '1-dimensional array of Byte'.

myTimeStamp = Convert.ToBase64String(CType(e.Item.Cells(5).Contr ols(1),
Label).Text)

"bruce barker" <no***********@safeco.com> wrote in message
news:eQ**************@TK2MSFTNGP10.phx.gbl...
'* store in field
CType(e.Item.Cells(5).Controls(1), Label).Text.Text =
System.ConvertToBase64String(myTimeStamp)

'* fetch from field
myTimeStamp = System.ConvertFromBase64(CType(e.Item.Cells(5).Con trols(1),
Label).Text)

-- bruce (sqlwork.com)

"Craig G" <craig.gamble@y_arrasoftware.com> wrote in message
news:OC**************@TK2MSFTNGP12.phx.gbl...
| i have a hidden template column that contains a label which is populated
| with a SQL Timestamp. the problem is each time i bring the timestamp out
it
| is coming out as "System.Byte[]" which is just a string
|
| i understand that the timestamp cannot be seen as its binary but what/how am
| i meant to store it in within the grid and then return it out if the user | selects that particular record
|
| ive just been using this to return other fields but that wont work for the | timestamp
| myTimeStamp = CType(e.Item.Cells(5).Controls(1), Label).Text
|
| anyone any idea's?
|
| Cheers,
| Craig
|
|

Nov 19 '05 #4
opps

should read
myTimeStamp = Convert.FromBase64String(CType(e.Item.Cells(5).Con trols(1),
Label).Text)

but i still get the 1-dimensional array of byte cannot be converted to
string

"bruce barker" <no***********@safeco.com> wrote in message
news:eQ**************@TK2MSFTNGP10.phx.gbl...
'* store in field
CType(e.Item.Cells(5).Controls(1), Label).Text.Text =
System.ConvertToBase64String(myTimeStamp)

'* fetch from field
myTimeStamp = System.ConvertFromBase64(CType(e.Item.Cells(5).Con trols(1),
Label).Text)

-- bruce (sqlwork.com)

"Craig G" <craig.gamble@y_arrasoftware.com> wrote in message
news:OC**************@TK2MSFTNGP12.phx.gbl...
| i have a hidden template column that contains a label which is populated
| with a SQL Timestamp. the problem is each time i bring the timestamp out
it
| is coming out as "System.Byte[]" which is just a string
|
| i understand that the timestamp cannot be seen as its binary but what/how am
| i meant to store it in within the grid and then return it out if the user | selects that particular record
|
| ive just been using this to return other fields but that wont work for the | timestamp
| myTimeStamp = CType(e.Item.Cells(5).Controls(1), Label).Text
|
| anyone any idea's?
|
| Cheers,
| Craig
|
|

Nov 19 '05 #5
alas i got there in the end!!

"Craig G" <craig.gamble@y_arrasoftware.com> wrote in message
news:OC**************@TK2MSFTNGP12.phx.gbl...
i have a hidden template column that contains a label which is populated
with a SQL Timestamp. the problem is each time i bring the timestamp out it is coming out as "System.Byte[]" which is just a string

i understand that the timestamp cannot be seen as its binary but what/how am i meant to store it in within the grid and then return it out if the user
selects that particular record

ive just been using this to return other fields but that wont work for the
timestamp
myTimeStamp = CType(e.Item.Cells(5).Controls(1), Label).Text

anyone any idea's?

Cheers,
Craig

Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: perplexed | last post by:
How do you convert a user inputted date to a unix timestamp before insterting it into your database? I have a form, with a textfield for a date that the user inputs in the format mm-dd-yyyy and...
2
by: rong.guo | last post by:
Hello Group, I am having a really weird problem... Can anyone tell the difference between Query 1 and Query 2 below? Why Query 2 excludes '2/28/2005'? Many thanks! create table a...
2
by: Alex | last post by:
Hi all, Got a small problem here. I have a number of web caches here that generate loads and loads of log files and instead of keeping them for analysis I want to write them to a db/2...
2
by: jay | last post by:
hi, Question on Load/import command. consider a sample table create table table_name ( col1 timestamp not null default current timestamp, col2 int, col3 int, col4 int, primary key(col1) );...
1
by: Roger Twomey | last post by:
I have a database that I don't want to lock. I decided that before any updates can occur I would check a timestamp value and ensure that nobody else updated before I did (avoiding the 'last update...
7
by: mybappy | last post by:
Hi: I am trying to use timestamp field of SQL Server to maintain concurrency. My problem is how do I store the timestamp value in my webform. The hidden field does not work as I get some cast...
5
by: pankaj_wolfhunter | last post by:
Greetings, In Sybase, a timestamp column is automatically loaded by the DB engine and its in some hex format. This is shown below id timestamp_value ----------- ------------------ 1...
7
by: JJ | last post by:
How do I set one field to have the updated timestamp, and another to have the created timestamp? I want to do this directly from code generated from DB Designer if possible?! JJ
6
by: marc | last post by:
hi im trying to convert Date() into a unix timestamp so i can stick the result into a mysql db, please help!
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.