saving date and time

Posted by saeed talaee on Stack Overflow See other posts from Stack Overflow or by saeed talaee
Published on 2012-06-30T05:32:00Z Indexed on 2012/06/30 15:16 UTC
Read the original article Hit count: 185

Filed under:
|
|

I want to save the time and date within my news but in the method below I save the time of the user and if his/her time is wrong, the wrong time will be save. How can I use the server's time instead.

SqlConnection sqlconn = new SqlConnection(connStr);
SqlCommand sqlcmd = new SqlCommand("insert into SubmitManuscript(username,title,authors,type,date,upload,reviewer1,email1,reviewer2,email2,reviewer3,email3)values(@username,@title,@authors,@type,@date,@upload,@reviewer1,@email1,@reviewer2,@email2,@reviewer3,@email3)", sqlconn);
sqlcmd.Parameters.AddWithValue("@username", username);
sqlcmd.Parameters.AddWithValue("@title", Text_Title.Text);
sqlcmd.Parameters.AddWithValue("@authors", Text_Author.Text);
sqlcmd.Parameters.AddWithValue("@type", dd_Type.SelectedItem.Text);
sqlcmd.Parameters.AddWithValue("@date", DateTime.Now);
//sqlcmd.Parameters.AddWithValue("@upload", "~/Suppelment/" + 

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about .NET