2
Reply

How to avoid time part from datetime datafield in access database using c#

Madhukumar Viswanathen

Madhukumar Viswanathen

Aug 19 2011 2:37 PM
2.2k
hai all
i have ms access table named table1

id       item   stock  price  code    stock_date                 model
1ball125    100  101/08/2011 12:00:00 AMadidas
2bat1501500202/08/2011 12:00:00 AMsii
3stump300100303/08/2011 12:00:00 AMsii
4pad505001018/08/2011 12:00:00 AMadidas
NULLNULLNULLNULLNULLNULLNULL


I want to find 02/08/2011 stock_date product details
I used below code
DateTimePicker1.value= 02/08/2011

oledcommand cmd = new oledd command("select * from table1 where stock_date="+ DateTimePicker1.value.ToShortString() +"",con);

In table1 stock_date have time part. So I cannot find the data. What changes I make in the code. please help me



Answers (2)