CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2003
    Posts
    6

    Crystal Report-Stored Procedure parameter

    i m using crystal report 7.0. i am using a stored procedure in the report and i have to pass parameters from vb. the problem i am facing is that whenever i am calling the report from vb, 'Enter Parameter value' dialog box appearing. how can i avoid this dialog box.
    also how can i pass date value as a stored procedure parameter?
    any one can help me.

  2. #2
    Join Date
    Jan 2003
    Location
    Birmingham UK
    Posts
    8
    Hiya,

    ok, you've two issues, so....

    A) Parameters & Viewing Crystal Reports
    You've not specified whether or not you are using Enterprise Server or some other method to display the report. This being a VB forum, I'll assume that's the one.

    1) Load the report (but do not show it)

    2) Set the parameter value (?Param1= etc). The method of achieving this is in the documentation - it's one of the few areas which are quite clear in Crystal (unlike RT, which is crud)

    3) Once the parameters have been set, THEN show the report. You shouldn't continue to have your problem, although if the parameter provided is an invalid datatype, then the report viewer will prompt you again.

    B) Passing Parameters To Stored Procs Using Crystal

    This is well easy! Instead of using a datetime datatype in the stored proc, use varchar(20), & pass in your date as a literal date (ie '26-Jan-2003 21:30:00')
    This not only sorts out the issue of changing connection methods (ie ODBC, ADO etc), it also removes any possible locale issues as well. SQL Server will happily coerce the varchar into a datetime when used as matching criteria to a datetime.

    If you're not confident of the validation, add a mask to the parameter that is persisted into the Crystal Designer.
    There is ALWAYS a better way.

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

Featured