Passing a Parameter Stored Proc to Local ReportViewer
I have a report written for Server mode that I've converted to Local mode. The original report had two parameters. Since I know that you don't pass parameters in local mode like you do in server mode, I removed the parameters from the .rdl before converting to .rdlc. I created a new form for the ReportViewer and used the SmartTags to setup my data source. My source is a stored procedure which has two parameters, a customer ID and an identifier to know whether to look in company #1 data or company #2 data. I have a line of code to pass the sp and parameters to a datatable in the form_load event:
Me.Sp_OpenDraftNoticeTableAdapter.Fill(Me.PetroDataSet.sp_OpenDraftNotice, 46, 2)but when I run this I get a blank report. However, if I create a new sp which simply calls the original sp and passes the parameters to it (exec sp_OpenDraftNotice 46,2) and pass that to the report, it works.
Me.Usp_TestDraftReportTableAdapter.Fill(Me.PetroDataSet1.usp_TestDraftReport)Naturally I update the report with the appropriate datasource name but I can't understand why the first method doesn't work.
Ultimately my program is to take a customer list, generate Draft Notices in PDF format and mail them to the customers.
Can anyone explain why the first fill method doesn't work? If I preview the data from Data->Preview Data... while on the ReportViewer form, it prompts for the two parameters and displays the correct data.
Thanks.
Loring

