2 Replies - 1989 Views - Last Post: 27 January 2013 - 12:12 AM Rate Topic: -----

#1 Ann1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 13-November 12

I want to retrive data between two dates to Crystal report

Posted 26 January 2013 - 08:03 AM

I want to retrieve data between two days usins vb.net 2008 and sql server 2005
thing coding I used
   Dim cryRpt As New ReportDocument
       

       [color="#008000"] CrystalReportViewer1.SelectionFormula = "{sell.Date}>=#" & DateTimePicker2.Value.Date & "# and {sell.Date}<=#" & DateTimePicker1.Value.Date & "#"[/color]
        cryRpt.Load("G:\Sales and inventory system\CrystalReport9.rpt")
        CrystalReportViewer1.ReportSource = cryRpt
        CrystalReportViewer1.Refresh()

when I put the highlighted coding nothing will be displayed
in sql I used the datetime data type
I save the data as
Dim date1 as date=DateTimePicker2.Value.Date 


Is This A Good Question/Topic? 0
  • +

Replies To: I want to retrive data between two dates to Crystal report

#2 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3822
  • View blog
  • Posts: 13,543
  • Joined: 12-December 12

Re: I want to retrive data between two dates to Crystal report

Posted 26 January 2013 - 08:18 AM

Try this:

CrystalReportViewer1.SelectionFormula = "{sell.Date}>=#" & _ 
    DateTimePicker2.Value.Date.ToString("MM/dd/yyyy") & _ 
    "# and {sell.Date}<=#" & DateTimePicker1.Value.Date.ToString("MM/dd/yyyy") & "#" 


Are DateTimePicker1 and 2 the correct way round?

I assume that these are not the actual names of these controls :)
Was This Post Helpful? 0
  • +
  • -

#3 Ann1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 13-November 12

Re: I want to retrive data between two dates to Crystal report

Posted 27 January 2013 - 12:12 AM

Thank you
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1