Results 1 to 12 of 12

Thread: Date Parameter

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2005
    Posts
    334

    Date Parameter

    Hi I hope this is the correct forum....

    I have created a report on Visual Studio .Net 2003 (using report wizard) atttached to SQL Server 2000. Everything fine, and the report returns the data required...

    The report has paramters including a dateto and datefrom.... can I introduce a calendar/datepicker or such control so that the format of the dates will always be correct?

    Or any other ideas on how i should do this???

    Thanks

  2. #2
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075

    Re: Date Parameter

    Can you just use the Format Editor?...right click on the object.
    It's tough being an unhandled exception...

    ___________
    VB.NET 2008
    VB.NET 2010
    ORACLE 11g
    CRYSTAL 11

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2005
    Posts
    334

    Re: Date Parameter

    Quote Originally Posted by EyeTalion
    Can you just use the Format Editor?...right click on the object.

    im soz... i dun get what u are sayin.... maybe I didnt explain properly... I dun have the control... thas what im askin for?!

    I can go to report parameters but that does not have anything important for this case!....

  4. #4
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075

    Re: Date Parameter

    Where is your date coming from? If it's coming from the database, place the field on the report and you can use the Format Editor to format it the way you like. If you need the user to input the dates, use the Parameter Field and you'll still have the ability to format the way you need..
    It's tough being an unhandled exception...

    ___________
    VB.NET 2008
    VB.NET 2010
    ORACLE 11g
    CRYSTAL 11

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2005
    Posts
    334

    Re: Date Parameter

    The user has to enter a start date and end date which are used in the "where" clause of my SQL query.... instead of having a textbox appear (where the user enters the date) I would like a DateTimePicker item appear, so the user has to select a date from a calendar.... is that possible?!

    I still dont really think you understand what I'm sayin - or I dont understand ur answer!!

    thanks....

  6. #6
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075

    Re: Date Parameter

    How about this? I'm assuming the report is embedded in a .NET app. Place two calendar controls on a form. Call one StartDate and the other endDate. Have the user select the two dates and then save them to a variable. Then use those variables in your SQL statement...then execute your report....hope this helps.
    It's tough being an unhandled exception...

    ___________
    VB.NET 2008
    VB.NET 2010
    ORACLE 11g
    CRYSTAL 11

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2005
    Posts
    334

    Re: Date Parameter

    Quote Originally Posted by EyeTalion
    How about this? I'm assuming the report is embedded in a .NET app. Place two calendar controls on a form. Call one StartDate and the other endDate. Have the user select the two dates and then save them to a variable. Then use those variables in your SQL statement...then execute your report....hope this helps.
    Thanks Sounds like a good idea...any idea how I would send the two parameters to the date?!

    thanks

  8. #8
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Question Re: Date Parameter

    Quote Originally Posted by pame1la
    Thanks Sounds like a good idea...any idea how I would send the two parameters to the date?!

    thanks
    Do you want to get the value between date

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2005
    Posts
    334

    Re: Date Parameter

    Quote Originally Posted by shakti5385
    Do you want to get the value between date

    No I need the DateTo and DateFrom for my query when creating the report, the report can create its own parameters, BUT i want the user to select the date from DateTimepicker control, and not enter it (like it does currently)...so that I can ensure date format is correct...

    I tried creating a form which has 2 datetimepicker and entered them into a dataset, but don't know how to set them in the report as the parameters

  10. #10
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Thumbs down Re: Date Parameter

    VB Code:
    1. Dim S As String
    2. S = "{Table.DateField}>=date( " & DTPicker1.Year & "," & DTPicker1.Month & "," & DTPicker1.Day & ") And {Table.DateField}<= date(" & DTPicker2.Year & "," & DTPicker2.Month & "," & DTPicker2.Day & ")"
    3. With CrystalReport1
    4.     .ReportFileName = App.Path & "\ReportName.rpt"
    5.     .SelectionFormula S
    6.     .Action = 1 'Will Show The Report
    7. End With


    Check the value of the S , I am passing here as a crystal report formula

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2005
    Posts
    334

    Re: Date Parameter

    Quote Originally Posted by shakti5385
    VB Code:
    1. Dim S As String
    2. S = "{Table.DateField}>=date( " & DTPicker1.Year & "," & DTPicker1.Month & "," & DTPicker1.Day & ") And {Table.DateField}<= date(" & DTPicker2.Year & "," & DTPicker2.Month & "," & DTPicker2.Day & ")"
    3. With CrystalReport1
    4.     .ReportFileName = App.Path & "\ReportName.rpt"
    5.     .SelectionFormula S
    6.     .Action = 1 'Will Show The Report
    7. End With


    Check the value of the S , I am passing here as a crystal report formula
    Soz for late reply, been away!!! Did I not mention, I am using SQL Server Reporting Services, and using Visual Studio .Net 2003 to create the report... I am not using crystal reports....
    Any more ideas?!

    Thanks

  12. #12
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Unhappy Re: Date Parameter

    Then what is the problem
    can you post the problem so the it i easy to other for understand

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width