tags:

views:

103

answers:

1

Hello,

Does someone knows how can I send a Timestamp value from C# to my Sql stored procedure which expect to get a timestamp value?

the sp looks like this

create sp1(@TS Timestamp)

--do do something...

go

A: 

MySqlCommand command = new MySqlCommand(); command.CommandText =@"sp1";
command.CommandType = CommandType.StoredProcedure;

command.Parameters.Add("@TS", MySqlType.TimeStamp, 15).Value = DateTime.Now;

Orsol
instead of DateTime.Now, can I assign a hex value which is a timestamp I took from somewhere else?
no, you need to convert timestamp to DateTime
Orsol
Try to use this for conversion. http://codeclimber.net.nz/archive/2007/07/10/convert-a-unix-timestamp-to-a-.net-datetime.aspx
Orsol
I'll do that. Thank you.