?
Solved

How to pass multiple parameters using ODBC

Posted on 2009-02-22
3
Medium Priority
?
629 Views
Last Modified: 2013-12-17
I am calling a report build in sql reporting services. I am using ODBC connection (this is must).
I call this report from a web site using the below code, without parameters its work perfectly fine but when i try to pass two parameters, an exception is coming "Parameter '1/2/2009' does not exist on this report". ODBC use only UNNAMED parameters (?).
how can i set parameters for this.
System.Collections.Generic.List<Microsoft.Reporting.WebForms.ReportParameter> Param = new System.Collections.Generic.List<Microsoft.Reporting.WebForms.ReportParameter>();
        Param.Add(new Microsoft.Reporting.WebForms.ReportParameter("1/2/2009"));
        Param.Add(new Microsoft.Reporting.WebForms.ReportParameter("1/4/2009"));
 
              System.Uri URL = new System.Uri("http://localhost/ReportServer$MSSQLSERVER2K5");
        rvDailyIVR.ServerReport.ReportServerUrl = URL;
        rvDailyIVR.ServerReport.ReportPath = "/Reports/DailyReport";
        rvDailyIVR.ServerReport.Timeout = 60000;
        rvDailyIVR.ServerReport.SetParameters(Param);
        rvDailyIVR.ServerReport.Refresh();

Open in new window

0
Comment
Question by:wateenitdev
2 Comments
 
LVL 19

Accepted Solution

by:
daveamour earned 1000 total points
ID: 23708973
It looks to me like your parameter is thinking it is called '1/2/'2009'
Do you have parametes set iwhich the report expects to receive?  I would think you will need to create a parameter matching this name and having a value of '1/2/'2009'
0
 
LVL 8

Assisted Solution

by:theplonk
theplonk earned 1000 total points
ID: 23709388
As daveamour said, you will need to create your parameters. You can do this by assigning ReportParameter array to the ServerReport.SetParameters method.

for reference vist: http://msdn.microsoft.com/en-us/library/aa337091.aspx

// Forexample if there are two date parameters: StartDate & FinishDate
        ReportParameter startDateParam = new ReportParameter();
        startDateParam.Name = "StartDate";
        startDate.Values.Add("1/2/2009");

        ReportParameter finishDateParam = new ReportParameter();
        finishDateParam.Name = "FinishDate";
        finishDate.Values.Add("1/2/2009");

        // Set the report parameters for the report
        rvDailyIVR.ServerReport.SetParameters(
            new ReportParameter[] { startDateParam, finishDateParam });
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question