---
title: "ASP.Net don't match the Access Date/Time Column"  
description: "ASP.Net don't match the Access Date/Time Column"  
author: "Anonymous User"  
published: 2015-01-16  
updated: 2015-01-16  
canonical: https://www.mindstick.com/forum/12864/asp-dot-net-don-t-match-the-access-date-time-column  
category: "asp.net"  
tags: ["c#", "ms access"]  
reading_time: 1 minute  

---

# ASP.Net don't match the Access Date/Time Column

I'm trying to sort for today. I am giving match error while I am comparing.

OleDbConnection baglanti = new OleDbConnection("[Provider](https://answers.mindstick.com/qa/92701/who-is-the-best-telecom-solution-provider)=Microsoft.ACE.OLEDB.12.0;Data [Source](https://www.mindstick.com/interview/840/what-happens-if-the-both-source-and-destination-are-named-same)=C:\\Users\\Dragonfly\\[Documents](https://www.mindstick.com/articles/156931/the-main-types-of-business-documents)\\[Visual Studio](https://www.mindstick.com/articles/12378/visual-studio-for-mac-is-out-of-beta-preview-now-officially-available) 2013\\WebSites\\WebSite2\\App_Data\\calismagunluk.mdb");

OleDbDataReader oku;

OleDbCommand sorgu =new OleDbCommand();

[DateTime](https://www.mindstick.com/forum/12949/how-to-validate-if-a-datetime-field-is-not-null-empty) bugun = DateTime.Now.Date;

sorgu.CommandText = "[select](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) * from calisan where kulID=" + sesionKulId +

" AND gun='" + bugun + "' ";

oku = sorgu.ExecuteReader();//I give error in here

if (oku.HasRows) {

Repeater1.DataSource = oku;

Repeater1.DataBind();

oku.Dispose();}

else{

Repeater1.Visible = false;

repeaterBos.Text = "Bugün Hiç Çalışma Yapmamışsınız...";

oku.Dispose();

}

I [am getting](https://www.mindstick.com/forum/34179/i-am-getting-error-while-assigning-the-data-to-the-array-list) this error: "Data type mismatch in criteria [expression](https://www.mindstick.com/articles/1861/sqlite-expressions)".

If I change the db [column](https://www.mindstick.com/forum/33860/how-to-calculate-column-summary-in-sql-server) to Text, it is working. But I don't want it this way. How should I follow the way?

## Replies

### Reply by Anonymous User

You can bypass the format problem and let the command work the format by itself by using parameters:

```
OleDbConnection baglanti = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\\Users\\Dragonfly\\Documents\\Visual Studio
2013\\WebSites\\WebSite2\\App_Data\\calismagunluk.mdb");
```

OleDbDataReader oku;

OleDbCommand sorgu =new OleDbCommand();

DateTime bugun = DateTime.Now.Date;

sorgu.CommandText = "select * from calisan where kulID=@ID AND gun=@date";

sorgu.Parameters.Add("@ID", OleDbType.Integer).Value = susionKulId;

sorgu.Parameters.Add("@date", OleDbType.DBTimeStamp).Value = bugun;


---

Original Source: https://www.mindstick.com/forum/12864/asp-dot-net-don-t-match-the-access-date-time-column

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
