select between two dates

show all records between two dates including the start date and end da

Page 1 of 1

2 Replies - 5237 Views - Last Post: 22 June 2009 - 12:09 AM Rate Topic: -----

#1 yangma  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 51
  • Joined: 03-May 09

select between two dates

Posted 21 June 2009 - 10:57 PM

 cmd = New SqlCommand("select * from employee_log where log_datetime >='" + DateTimePicker1.Value.Date + "'   And  log_datetime<= '" + DateTimePicker2.Value.Date + "'	", cn)

suppose if i select two dates june 21 and june 30 then records between 21 and 30 including 21 and 30 should be shown..but the records of june 30 is not shown..only from 21 to 29 is shown by this code...
wat should i add or edit to this code??thanks

Is This A Good Question/Topic? 0
  • +

Replies To: select between two dates

#2 noorahmad  Icon User is offline

  • Untitled
  • member icon

Reputation: 209
  • View blog
  • Posts: 2,290
  • Joined: 12-March 09

Re: select between two dates

Posted 21 June 2009 - 11:38 PM

simply use
cmd = New SqlCommand("select * from employee_log where log_datetime Between '" + DateTimePicker1.Value.Date + "'   And  '" + DateTimePicker2.Value.Date + "'    ", cn)


Let Know it Was Help Full :)
Was This Post Helpful? 0
  • +
  • -

#3 yangma  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 51
  • Joined: 03-May 09

Re: select between two dates

Posted 22 June 2009 - 12:09 AM

that results same as above .....last date is not showing
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1