Topic: Report from stored procedure Posted: 18 Jan 2011 at 12:03am
hi everyone, i am trying to develop a report in crystal report from stored procedure using data set. but i do not know how to do that. in my stored procedure there are two parameter which i need to pass. the code for stored procedure is given bellow:
ALTER PROCEDURE [dbo].[sl_member_balance_by_dates] -- Add the parameters for the stored procedure here ( @start_date datetime, @close_date datetime ) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON;
-- Insert statements for procedure here SELECT member_info.member_id, member_info.shop_no, member_info.member_name, isnull(bi.billAmount, 0) AS bill, isnull(ac.payAmount, 0) AS payment, isnull(bi.billAmount, 0) - isnull(ac.payAmount, 0) as dues FROM member_info INNER JOIN ( SELECT member_bill.member_id, sum(bill_info.bill_amount) AS billAmount FROM bill_info, member_bill WHERE bill_info.bill_id = member_bill.bill_id AND bill_info.bill_date >= @start_date AND bill_info.bill_date <= @close_date GROUP BY member_id ) AS bi ON member_info.member_id = bi.member_id LEFT OUTER JOIN ( SELECT member_id, sum(credit_amount) AS payAmount FROM accounts_transaction WHERE transaction_date >= @start_date AND transaction_date <= @close_date GROUP BY member_id ) AS ac ON member_info.member_id = ac.member_id GROUP BY member_info.member_id, member_info.shop_no, member_info.member_name, bi.billAmount, ac.payAmount order by member_info.member_id
any one plz provide me step by step suggestions how to do that including calling in c# form to show the final report in my software. plz also tell me how to set parameter in report design by creating parameter field while i m not showing those fields in my report which will takes values to run. thanks to u all.
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Posted: 18 Jan 2011 at 3:30am
if you want the report to run off of a stored procedure, click on database expert, select a new connection or an existing one if you are odbc or some of the other types, I only use ado.net so don't remember what is needed for the other connection. select dbo/stored procedures/your procedure name. click ok. done.
probably follow the prompts to have cr 'run' the stored proc and determine the dataset schema.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum