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

sqldatasource

9 Answers 305 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
rgf21
Top achievements
Rank 1
rgf21 asked on 01 Oct 2007, 02:55 PM
how can I make a report using a sqldatasoure? I have to pass a parameter with the Id I want to use to get the data I need. How can I do that.

thanks

9 Answers, 1 is accepted

Sort by
0
Hrisi
Telerik team
answered on 01 Oct 2007, 04:22 PM
Hi rgf21,

We have a nice example how to use query parameters in Telerik Reporting. In the next major release we will provide build-in support for these.

 
Greetings,
Hrisi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
rgf21
Top achievements
Rank 1
answered on 01 Oct 2007, 04:54 PM
I don't have an sqldataadapter in my toolbox...
0
Svetoslav
Telerik team
answered on 02 Oct 2007, 09:18 AM
Hello rgf21,

In addition to the video we sent you yesterday, please review this help topic that describes how to use data adapters.

 
Greetings,
Svetoslav
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
rgf21
Top achievements
Rank 1
answered on 02 Oct 2007, 10:50 AM
hi. I'm almost there.

I have created the report Formando.vb in my App_Code folder. It has a parameter named ID. In my other page I have a ReportViewer1 were in the properties I selected the report (Formando, App_Code.qswomq_6, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null). Now I want to do something like this: when i open my page, I want that to pass to the report the query string. I tried this:

    Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
        ReportViewer1.Report.ReportParameters(0).Value = Request.QueryString("ID")  
    End Sub 

But it isn't working. Is there another way? thanks again


0
Svetoslav
Telerik team
answered on 02 Oct 2007, 03:38 PM
Hello rgf21,

Before getting to your question, we would recommend separating your reports in a class library project. The Web Site project has some limitations which will prevent you from using the tool fully. You can review the provided documentation for more info on creating reports in a class library project.

Now to your question - we do not find any problems in the code snippet you have sent that would cause any issues. However, it is not clear what is the exact problem you have encountered and what is expected to happen. Please, examine all the reporting examples especially ProductLineSales where you can find how to use report parameters. Also have in mind that we're continue working on them as currently report parameters have limited application.

We would also highly recommend reviewing the documentation and support videos as they hold valuable information on using the Reporting tool.
 

Regards,
Svetoslav
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
rgf21
Top achievements
Rank 1
answered on 02 Oct 2007, 03:50 PM
I'm getting System.ArgumentOutOfRangeException. I will have a look at documentation again.

I found a way. :))

Thanks
0
Hrisi
Telerik team
answered on 03 Oct 2007, 12:06 PM
Hello rgf21,

Maybe the problem is the next piece of code: ReportViewer1.Report.ReportParameters(0) . Before setting the Report parameter  you should add it to the ReportParameters collection

Best wishes,
Hrisi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
rgf21
Top achievements
Rank 1
answered on 03 Oct 2007, 01:44 PM
I found a way. Thanks again!
0
Brandon
Top achievements
Rank 1
answered on 09 Aug 2011, 11:26 PM
I too was trying to call a report using the querystring to pass a parameter.

Here is what I did to make it work...

  1. at the Report Properties window, set a parameter (in my case I called it County)  -- select the report by clicking the upper left corner block on the designer then when you select parameter from the properties, you will need to add a new one and give it a name and a default value -- so if the page gets called without a querystring, it will still run.
  2. Now go to the SQL Data Adapter (if you used this item to grab and utilize a stored procedure or just a select statement) and go to the properties and under parameter put in something like
    @County
    AnsiString
    Parameters.County.Value
  3. Now go to the report viewer.  My Report Viewer is named RVPollBook
    Go to View Code and add these lines to the Page_Load event

    If Request.QueryString("county") IsNot Nothing Then
        
RVPollBook.Report.ReportParameters(0).Value = Request.QueryString("county")
    
End

Now when I pass in something like PollBookv.aspx?county=22 I get all the items with a county number of 22.... yea!

 

Tags
General Discussions
Asked by
rgf21
Top achievements
Rank 1
Answers by
Hrisi
Telerik team
rgf21
Top achievements
Rank 1
Svetoslav
Telerik team
Brandon
Top achievements
Rank 1
Share this question
or