i have SQL server database and table with column for date (date datatype). I would like to change the value of date column for all records to have todays date, but something is not working, please help. My code:
con.Open();
DateTime date = DateTime.Now.Date;
string insStr = "UPDATE tblBusiness SET DateCreated = @Date;";
SqlCommand updateDate = new SqlCommand(insStr, con);
updateDate.Parameters.AddWithValue("Date", date);
updateDate.ExecuteNonQuery();
con.Close();
Thanks, Oak
EDIT: Thanks for the answers. The thing why it was not working was because of too many records in database and the default update timeout is 30sec or something. And thats why no record was changed. updateDate.CommandTimeout = 0; fixed the problem.