I’m storing in my database using a store procedure the date time stamp using a function called sysdatetime() and a type of varchar(max) which stores in the database in this format yyyy-mm-dd hh:mm:ss.sssssss. When I’m creating a new post its fine but when I’m trying to update the record I have to send a parameter to the store procedure with the current datetime. I have tried this one
DateTime.Now.ToString(yyyy-mm-dd hh:mm:ss.sssssss)
but I’m getting an error. what i have to do?
P.s: see the image below with the error message

I suspect if you really need the string representation, you actually want:
Note that:
UtcNowinstead ofNow. For timestamps, you almost always want UTC.CultureInfo.InvariantCultureSee MSDN for more details of custom date and time formatting.
However, I’d strongly recommend that you try to avoid string conversions wherever possible. Why can’t your stored procedure just use the relevant
DateTimetype instead of a string representation? Then you can pass the value to the stored procedure as aDateTime(via a command parameter) and you can get rid of the error-prone string conversion clutter.