Friday, February 24, 2012

C# Command Timestamp Input Parameter

I have a stored proc that inserts a customer and it expects a timestamp input parameter. I dont know what a timestamp datatype is for sql 2005 and Ive tried to parse all sorts of data types but the proc errors out saying it needs "Byte[]" which Ive tried. Can anyone help me with this? Thanks

Ryan

Have you tried the plain DateTime data type?|||

Hi Ryan,

The timestamp in SQL Server maps to a Byte[] type in .NET framework. It is not used as DateTime. It is a data type that exposes automatically generated, unique binary numbers within a database. timestamp is generally used as a mechanism for version-stamping table rows.

If you just need to store date/time information, try to use datetime data type, it maps to a DateTime object in .NET framework.

Please check the following link for more information:

http://msdn2.microsoft.com/en-us/library/ms182776.aspx
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconmappingnetdataproviderdatatypestonetframeworkdatatypes.asp

HTH. If this does not answer your question, please feel free to mark the post as Not Answered and reply. Thank you!

No comments:

Post a Comment