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

[1903 byte] By [Loring] at [2007-12-25]
# 1
If you take your first method and connect it to something simple, like a DataGridView control, does it display the data?
BrianHartman-MSFT at 2007-8-31 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 2
Well I started simple and created a new simple report with just a table. Passing the sp to it worked. So that narrowed it down to a problem in the report, not my line of code. Working with table adapters is somewhat confusing with all the various objects created. I think I just didn't pass the right datasource to the report in the viewer IDE. Now everything works as I expected. Unfortunately I don't have any nugget to pass on to say this fixed it. Just check each data element carefully and start over recreating data sources if necessary.
Loring at 2007-8-31 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...

Visual Studio

Site Classified