Posted on: 9/23/2013 3:30:32 AM | Views : 673

Hi all, how come I am getting this error?
String was not recognized as a valid DateTime. if (TextBox1.Text != null || TextBox2.Text != null || TextBox4.Text != null) { DateTime selected = DateTime.ParseExact(TextBox1.Text, "dd-MM-yyyy", null); DateTime now = Convert.ToDateTime(DateTime.Now.ToShortDateString()); if (selected <= now) { TextBox1.Text = DateTime.Now.ToString("yyyy-MM-dd"); } string user = (string)Session["UserID"]; string getSelectedDate = ""; getSelectedDate = selected.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); string mySQL; MySqlConnection connSubmit = new MySqlConnection(connStr); connSubmit.Open(); mySQL = "INSERT into Attendance(StartDate, EndDate, Reason, UserID) VALUES(N'" + getSelectedDate + "', N'" + getSelectedDate + "', ?Reason, ...

Go to the complete details ...