title: asp.net 2010 with c# and access 2003
body: <p>I am new to asp.net and am building a site for hotel. I need to compare the check in date with check out date stored in an access database.  The result is shown via a data grid but when I compare it, I get a data type mismatch criteria expression. I can connect to the access database and I use a calendar to pass the date via a textbox.</p>
  
  <p>This is my code:</p>
  
  <pre><code>protected void Button1_Click(object sender, EventArgs e)
  {
      ds = new DataSet();
      st ="select * from abc where status = 'v'and checkout= '" + Convert.ToDateTime(TextBox1.Text) + "'";
      adp = new OleDbDataAdapter(st, cn);
      int r = adp.Fill(ds, "app");
      GridView1.DataSource = ds;
      GridView1.DataMember = "app";
      GridView1.DataBind();
      int intCount;
      intCount = ds.Tables["app"].Rows.Count;
      Label1.Text = intCount.ToString();
  
  }
  
  protected void Calendar1_SelectionChanged(object sender, EventArgs e)
  {
      TextBox1.Text = Calendar1.SelectedDate.ToString("MM/dd/yy");
  }
  </code></pre>