Stored Procedures

runswithsizzors

Well-known member
Joined
May 11, 2005
Messages
70
Location
Northern Michigan
Programming Experience
5-10
Just started to play around creating Crystal Reports with Stored Procedures. Not sure if this is allowed or not. But I have a stored procedure with a return value, is there any way or how can I display that value in the report? Thanks!
 
There are a few ways in which you can do this in order to get the value.

Since you are running a stored procedure I am going to assume that you are using the command object. There are few different ways you can execute based on what you are looking to get from the procedure. If you are getting a single value from a single column (if you are returning a single integer that indicates success/failure) you can simply use the execute scalar method and this returns an object with the single value. However, if your stored procedure is returning a lot of data you can execute reader. There is also the option of using a data adapter so that you can fill a dataset with the stored procedure return values depending on what you need to do with the returned data. This would be the best option if you wanted to fill a datatable or a dataset. If not you should just use the command object and make sure you specify the command type as stored procedure.
 
Thanks for the post. I am actually trying to connect to the stored procedure inside of crystal and getting it displayed in there. I need the parameters passed into the stored procedure to be linked to the details as it is looped through rows. I had a complicated quantity formula so I created a stored procedure using .net and trying to link that into the crystal report. Sorry I should have explained that one a little better.
 
Back
Top