title: Unable to convert textbox(dd/MM/yyyy) date to datetime format
body: <p>I have a database date "2014-11-26". I have a calender with format(dd-MM-yyyy) I am trying to bring some values to my form from databse by textbox selected date</p>
  
  <pre><code>  protected void txtdate_TextChanged(object sender, EventArgs e)
      {
  
          //DateTime timeIn = Convert.ToDateTime(txtdate.Text);
         // DateTime time1 = DateTime.ParseExact(txtdate.Text, "yyyy-MM-dd", CultureInfo.InvariantCulture);
          str = "select TimeIn,TimeOut from MusterRoll where EmpCode='" + ddcode.SelectedItem.Text + "' and Date='"+time1+"'";
          dr = conn.query(str);
          if (dr.Read())
          {
              DateTime time = dr.GetDateTime(0);
              TimeSelector1.SetTime(time.Hour, time.Minute, TimeSelector1.AmPm);
              DateTime time2 = dr.GetDateTime(1);
              TimeSelector2.SetTime(time2.Hour, time2.Minute, TimeSelector2.AmPm);
          }
  
      }
  </code></pre>
  
  <p>The problem is databse date format and my calender format is different. I tried two methods(which I placed in command line)but shows error message like <code>"input string was not in correct format"</code>. I surfed internet and find these same answers. May I know why it shows error?? i am trying to make database dateformat and calender format as same</p>