title: Sql query to search database by date
body: <p>Can somebody advice me with the sql query to search ms database with specific date.</p>
  
  <p>For example i want to search for all the transaction in day 13/02/2013.
  In my database i have one column called Purchased Date which stores the date of purchase.</p>
  
  <p>In database the date is stored in this format 16/02/2013 02:47:36 AM.</p>
  
  <p>I want tom enter the date which i want in the text box and then pass that value to the query.</p>
  
  <pre><code> public DataSet OrderByDate(DateTime date)
          {
              //  string connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\Amrit\\Desktop\\Database.accdb ;Persist Security Info=False;";
              DataSet dataSet = new DataSet();
              OleDbConnection oleConn = new OleDbConnection(connString);
  
              try
              {
                  oleConn.Open();
                  string sql = "SELECT  Customer.[Title] + SPACE(2)  + Customer.[Customer's Name] as CustomerName, Customer.[Customer's Ebayname], Customer.[Email Address], Customer.[Phone Number], Customer.[Address 1] + SPACE(2)  +Customer.[Address 2] + SPACE(2)  + Customer.[City] + SPACE(2)  + Customer.[Post Code]+  SPACE(2)  + Customer.[Country] as Address, Customer.[Item Purchased], Customer.[Purchased Date], Customer.[Total Price] FROM Customer WHERE [Purchased Date]='" + date;
                  OleDbDataAdapter dataAdapter = new OleDbDataAdapter(sql, oleConn);
                  dataAdapter.Fill(dataSet, "Customer");
              }
              catch (Exception ex)
              {
                  Console.WriteLine(ex.ToString());
              }
              finally
              {
                  oleConn.Close();
              }
              if (dataSet.Tables.Count &lt;= 0)
                  return null;
              else
                  return dataSet;
          }
  </code></pre>