• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 383
  • Last Modified:

Crystal Reports XI command parameters revert to string

I have a crystal report that has a subreport that uses a stored procedure. I close the RPT file and when I reopen it the parameters in the command section go from being a date (which is correct) to being a string (which is incorrect).

This immediatly unlinks the parameter fields on my main report because my parameters are set as a date so I get the proper calander box.  You cannot link a string param in a command to a date (or date/time) in a report.

Anyone know what could be causing this?  It is driving me nuts.
Stored Procedure Parameters:
 
@p_network_id varchar(20),				
@p_ActvStatus int,				
@p_startdate datetime,			
@p_enddate datetime

Open in new window

0
Mike DeFelice
Asked:
Mike DeFelice
  • 6
  • 4
  • 2
1 Solution
 
jgbreedenCommented:
I've never called a stored procedure directly from crystal, so maybe this should be obvious to me, but when you say "the parameters in the command section", do you mean the parameters being passed to the stored procedure, or the parameters being passed from the main report to the sub?
0
 
Mike DeFeliceAuthor Commented:
I went into the database expert and added the command:
Exec [SP_CSR-701_CallMemo]  '{?CurrentCeUser}','{?Scope}','{?Status}','{?Start Date}', '{?End Date}'

It also requires you to define the above parameters...  I defined CurrentCeUser, scope and status as a string.  Start and end dates are defined as datetime
0
 
jgbreedenCommented:
I really don't know, I can tell you we have stored procs we call from .net, and for the datetime parameters we pass them into sql as strings, then CONVERT them to datetime in the proc.  I'm not sure why it was done that way, but if you have access to edit the proc and it is not used by a bunch of other processes that still expect dates, it could work for you.

If you choose Verify Database before you close the report, does it complain about the parameters at that point?
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
James0628Commented:
This doesn't really answer your question, but if all that the command does is execute a stored procedure, why not just execute the procedure directly from your report?  When you reference the procedure directly, CR automatically adds the parameters that the procedure requires, with the correct type for each parameter.

 James
0
 
Mike DeFeliceAuthor Commented:
I know there is a reason why we did not directly add the stored procedure to the report.  I believe it had something to do with it being a subreport that relies on the main report to call CurrentCEUser...
0
 
Mike DeFeliceAuthor Commented:
When I verify the database it is fine.  It was when i closed it and reopened it I had a problem.  I also have a problem randomly when I run it.

The reason that I am using a datetime parameter is because if you use a string you cannot use the calendar to select the days in the report parameter.  Even if you set the parameter as a string and set up a virtual field to convert it to a string Crystal does not recognize the virtual field as a string you can link the report and subreport with.
0
 
Mike DeFeliceAuthor Commented:
I just gave up the boat on this... I brought the stored procedure in directly instead of calling it in a command.  Does anyone know if this is more/less efficent?

Thanks

Mike
0
 
James0628Commented:
You mean that the report is now just executing the stored procedure, instead of a command that executes the procedure?  I don't actually know which is more efficient, but I would _expect_ executing the procedure directly to be more efficient than executing a command that executes the procedure.  That just seems like common sense (the fewer steps the better).  But I could be wrong.

 However, if you mean that you copied the stored procedure into a command, so now the report is executing a command that contains the stored procedure code, instead of a command that executes the stored procedure, I'd have to guess that the command that executes a stored procedure would probably be more efficient, because of the way the server can optimize stored procedures.  But that's also really just a guess, and I'm sure it would depend on your stored procedure.  If it's very simple, it may not matter much either way.

 James
0
 
Mike DeFeliceAuthor Commented:
I actually moved the stored procedure in using the database expert.  I no longer have any code in the command.

0
 
James0628Commented:
OK.  That seems like the best way to use them to me, but the fact is that I've always done it that way, so I don't really have anything to compare it against.

 James
0
 
Mike DeFeliceAuthor Commented:
Then I have a question for you... If we make an update that it is code only.... Do I have to verify the database again?  Or does that happen every time I run it?
0
 
James0628Commented:
I don't think you need to do a "verify database" unless the form of the output from the procedure is changed (a column is added or removed, a column size is changed, etc.).  That's the only time that I worry about doing one.

 If you want to try to force the report to look for changes, you can try checking the "Verify Stored Procedures on First Refresh" option under File > "Report Options".  I really can't say what effect it will have, since I don't normally use it.

 James
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now