This is a migrated thread and some comments may be shown as answers.

Parameters not being passed to stored proc

6 Answers 307 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Andrew Diamon
Top achievements
Rank 1
Andrew Diamon asked on 20 Dec 2012, 09:55 PM
Ever since I upgraded to the latest version of Reporting the SqlDataSource will not pass parameter values to my stored proc.  I'm using Silverlight.  It ALWAYS says procedure or function expects parameter...  Even if I hard code the value it will not pass it!

It worked fine in the previous version.

ObjectDataSource DOES pass parameters, but a stored proc will not work.

6 Answers, 1 is accepted

Sort by
0
Elian
Telerik team
answered on 27 Dec 2012, 10:49 AM
Hi Andrew,

We were not able to reproduce the problem with version 6.2.12.1123. Please give us some additional information on your scenario.
  • What version of Telerik Reporting are you using?
  • Does the SqlDataSource behave as expected in other viewers?
  • How do you pass the parameters to the SqlDataSource (with Report Parameters or not)? 
Any information that you think could be relevant is appreciated.
Additionally if it is possible to isolate the problem into a small sample project, you can open a support thread and attach it there along with the data-base. 

Greetings,
Elian
the Telerik team

HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
Andrew Diamon
Top achievements
Rank 1
answered on 08 Jan 2013, 05:47 PM
6.2.12.1017

The control seems to think this is the latest version.  Where do I get 6.2.12.1123?
0
Steve
Telerik team
answered on 11 Jan 2013, 03:08 PM
Hello Andrew,

The Control Panel would only show official versions, while my colleague has tested with the latest internal build. You have to log-in to your client account and there you would be able to find and download internal builds.

Anyway, we released Q3 SP1 2012 release yesterday, and we urge you to download it and upgrade. If the issue persists with it, try to isolate the problem into a small sample project which you can attach in an official support ticket.

All the best,
Steve
the Telerik team

HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
Igor
Top achievements
Rank 1
answered on 14 Jan 2013, 02:06 AM
Hi Steve,

I upgraded my telerik reporting to Q3 2012.
I am using telerik reporting for silverlight.
Unfortunately report parameters are passed with null values now.

Here are the code:

Silverlight:
private void reportViewer_RenderBegin(object sender, RenderBeginEventArgs args)
{
    args.ParameterValues["ProjectID"] = (cbProjects.SelectedItem as Project).ProjectID; }








Report:
Constructor
InitializeComponent();
ReportParameters.Add("ProjectID"ReportParameterType.Integer, null);




private void table1_NeedDataSource(object sender, EventArgs e)
{
    var parameterCollection = ReportParameters;     var dataSet = ProjectHoursBLL.GetWorkedHoursByProjectID(Convert.ToInt32(parameterCollection["ProjectID"].Value.ToString()));
    (sender as Telerik.Reporting.Processing.Table).DataSource = dataSet; }


For some reason parameterCollection["ProjectID"].Value returns null.
I checked all dll references and they are all pointing to the Q3 2012 version.
Reports that do not require parameters are working.
Every report that require parameter is not working (parameter value is passed as null).

Please help.

Regards

Igor
0
Peter
Telerik team
answered on 16 Jan 2013, 08:03 AM
Hello Igor, 
The recommended approach to access the report parameters processing values in events is shown in the following code snippet:
private void table1_NeedDataSource(object sender, EventArgs e)
{
    var table= (sender as Telerik.Reporting.Processing.Table);
    var dataSet = ProjectHoursBLL.GetWorkedHoursByProjectID(Convert.ToInt32(table.Parameters["ProjectID"].Value.ToString()));
    table.DataSource = dataSet;
}

You may find useful the Using Report Parameters programmatically help article.

Kind regards,
Peter
the Telerik team

HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
Bob
Top achievements
Rank 1
answered on 22 Jan 2013, 11:50 PM
After updating to version 6.2.13.110 the following no longer works and only returnes Null values?

string test = this.Report.ReportParameters[0].Value.ToString();


As a result the NeedDataSource event also returns "Object reference not set to an instance of an object. We need the new verison because it corrects the issue of crashing the program when we print the report.
Any ideas?

Bobn


Update - This worked. 
Placed in the ItemDataBinding event. 
Telerik.Reporting.Processing.Report rpt = (Telerik.Reporting.Processing.Report)sender;
        var obj = rpt.Parameters;
 
       Classes.Global.GlobalBillAssmnt= obj["ID"].Value.ToString();
       
 
       

 

Tags
General Discussions
Asked by
Andrew Diamon
Top achievements
Rank 1
Answers by
Elian
Telerik team
Andrew Diamon
Top achievements
Rank 1
Steve
Telerik team
Igor
Top achievements
Rank 1
Peter
Telerik team
Bob
Top achievements
Rank 1
Share this question
or