if (txt_SendAt.Text != null)
{
//string SendAt_date = txt_Respondby.Text;
DateTime Send_date = Convert.ToDateTime(txt_SendAt.Text);
param[15] = new MySqlParameter("@SendDate", MySqlDbType.DateTime);
param[15].Value = Send_date;
command.Parameters.AddWithValue("@SendDate", Send_date);
}
else
{
param[15] = new MySqlParameter("@SendDate", MySqlDbType.DateTime);
param[15].Value = now;
command.Parameters.AddWithValue("@SendDate", now);
}
I have a text box where i select date and time from a calender. When I leave the text box empty it should execute the statements in else condition but it executes the statement in if. Where am I going wrong
I am getting this error if i leave it blank String was not recognized as a valid DateTime.
nowis a DateTime variable (probably set to DateTime.Now). Is that correct or is it a string? If a string, what's it's value?