DateTime validate; if (DateTime.TryParse(tbDOB.Text, out validate)) { update.Parameters.AddWithValue("@dob", tbDOB.Text); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Window", "alert('Enter Valid Date');", true); }
Try { Datetime myDate = Datetime.Parse(someTextBox.Text) } Catch (Exception ex) { 'Not a valid Date 'your Msg Goes Hear.... 'Do Something
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)