title: get only date from sql
body: <p>I need to get the date part only from SQL. SQL data type is date but when i tried to call it it returns this value <code>01-Mar-14 12:00:00 AM</code>. The only part I'm interested in is <code>01-Mar-14</code> I've a long search in stackoverflow and microsoft and google but in vain.
  <a href="https://stackoverflow.com/questions/5125609/how-to-select-date-without-time-in-sql">First search didn't work with me</a><br>
  <a href="https://stackoverflow.com/questions/133081/most-efficient-way-in-sql-server-to-get-date-from-datetime">also this one didn't work out</a><br>
  Here is my C# code to get these values. </p>
  
  <pre><code>private void SearchName_Click(object sender, EventArgs e)     
  {                
        db.con.Open();
        SqlDataReader reader;
        SqlCommand command = new SqlCommand("select * from Employee inner join DatePics on ID=Emp_ID where EmpName='" + SearNametxt.Text + "' ", db.con);                
        reader = command.ExecuteReader();
        while (reader.Read())
        {
             NameSeartxt.Text = (reader["EmpName"].ToString());                   
             PassSeartxt.Text = (reader["Passport"].ToString());               
             IDSeartxt.Text = (reader["IDIssue"].ToString());
             expiryseartxt.Text = (reader["IDExpiry"].ToString());                  
        }
        db.con.Close();
  }
  </code></pre>
  
  <p>but also return only the whole format. Tried to use this one, but fail.<br>
  <code>select convert(varchar(10), '01-Mar-14 12:00:00', 120)</code>  </p>
  
  <p><strong>EDIT:</strong> latest code:</p>
  
  <pre><code>db.con.Open();
  SqlDataReader reader; 
  SqlCommand command = new SqlCommand("select * from Employee inner join 
       DatePics on ID=Emp_ID where EmpName='" + SearNametxt.Text + "' ", db.con);
  reader = command.ExecuteReader(); 
  while (reader.Read()) 
  {
   DateTime Received; 
   DateTime.TryParse(reader["ReceivedDate"], CultureInfo.InvariantCulture,  
                                      DateTimeStyles.None, out Received); 
   recsearchtxt.Text = Received.ToString("d");
  </code></pre>