On inserting the date via asp.net to SQL Server 2008 an error is happening.
Insert statement
Insert into comment(CommentFrom, CommentTo, Comment, Cmntonscrap, Cmnttime)
Values('" + Session["UserName"] + "','" + email.Text.ToString() + "','" +
txt.Text.ToString().Trim() + "','" + cscrap.Text.ToString().Trim() +
"','" + DateTime.Now.ToString().Trim() + "')";
Error:
string or binary data would be truncated,Statement is terminating
Your problem is not with the date.
Its with the string data being too large for a column(probably a varchar), that you are trying to insert the data into.
I would check the length of your
Commentandtxt.Textand see that the data can be inserted.Use a sql type
datetimefor yourDateTime. Storing dates in a text column is inviting a lot of trouble.