locked
Plz Plz Plz ppl i need help in my ReportViewer RRS feed

  • Question

  • User273232671 posted

    Hello ppl, Please i have been dying to get this to work but no help what so ever, i tried so many ways and so many searches but i always reached a dead end..

    I have a ReportWizard that i created, an .rdlc file,  and i have a report Viewer tool in my .aspx page that i linked it to my .rdlc report, and i have a DataSet1.xsd Data Set also created, in my data set, i have put this SQL statement:

    SELECT        Case_Number, Staff_FName, Staff_LName, Branch_Dept, Case_Category,  Case_Date, Closed_Date, Problem, Initial_Solution, Customer_Name, Acc_Num
    FROM            SQ_IMS
    WHERE        (Case_Date >= '@date1') AND (Case_Date <= '@date2')

    Now if i want my user to chose 2 values from 2 textboxes in my aspx page, and then send it to the report to be generated, i guessed that i have to use parameters, and that is how i used it in my WHERE statement, the @date1 and @date2, but the problem now, is that i am stuck on what to write in my button click, please if someone can give me the code, or show me a hint of that code, in VB.NET please, i would really really apreciate it, i really really need it urgently, and thanx alot in advance.

     

    Thursday, December 8, 2011 3:59 PM

All replies

  • User9952089 posted

    LocalReport myReport = new LocalReport(); 
    myReport
    .ReportPath = Server.MapPath("~/Path/To/Report.rdlc"); 
     
    ReportParameter myParam
    = new ReportParameter("ParamName", "ParamValue"); 
    myReport
    .SetParameters(new ReportParameter[] { myParam }); 
     
    // more code here to render report

    Thursday, December 8, 2011 4:06 PM
  • User9952089 posted

    also did you verified below article???????

    http://www.csharpcourses.com/2008/06/how-to-pass-parameters-to-reporting.html

     

    ReportViewer1.ShowCredentialPrompts = False
    
    ReportViewer1.ServerReport.ReportServerCredentials = New ReportCredentials("emady", "MyPassword", "hhi")
    
    ReportViewer1.ServerReport.ReportServerUrl = New Uri("http://falcon/Reportserver")
    
    ReportViewer1.ServerReport.ReportPath = "/Report Project State/Report1"
    
    
    Dim parameters As New List(Of ReportParameter)()
    
    parameters.Add(New ReportParameter("state", DropDownListStates.SelectedItem.Text))
    
    ReportViewer1.ServerReport.SetParameters(parameters)
    
    
    ReportViewer1.ProcessingMode = ProcessingMode.Remote
    
    ReportViewer1.ShowParameterPrompts = False
    
    ReportViewer1.ShowPromptAreaButton = False
    
    ReportViewer1.ServerReport.Refresh()
    
    
    Thursday, December 8, 2011 4:08 PM
  • User273232671 posted

    But this is for server reports, isnt?

    Thursday, December 8, 2011 4:12 PM
  • User273232671 posted

    Mine is local

    Thursday, December 8, 2011 4:13 PM
  • User9952089 posted

    when you say local....is that report server project completely separate SSRS project?

    If that is the case, do you wants to know how the report parameter needs to create so user can select certain values...

    Please explain...looks like i am getting har time understanding the system........

    Thursday, December 8, 2011 4:22 PM
  • User273232671 posted

    Yes its a local report in my project, no servers attached, the report .rdlc file is included in my solution it self, now in my button click, i want to know how to access the report, plus how to pass the parameters of my 2 textboxes to send 2 dates and get the report between these 2 dates, and thank you.

    Thursday, December 8, 2011 4:26 PM
  • User9952089 posted

    did you tried below codes........

    LocalReport myReport = new LocalReport(); 
    myReport
    .ReportPath = Server.MapPath("~/Path/To/Report.rdlc"); 
     
    ReportParameter myParam
    = new ReportParameter("ParamName", "ParamValue"); 
    myReport
    .SetParameters(new ReportParameter[] { myParam }); 
     
    // more code here to render report

    Thursday, December 8, 2011 4:30 PM
  • User273232671 posted

    ok i tried ur code and got this error:

     

    An attempt was made to set a report parameter 'date1' that is not defined in this report.

     

    here is how ur code looks like after i edited it to my values:

    Dim myReport As New LocalReport

    ()

    myReport.ReportPath = Server.MapPath(

    "~/ComplianceReport.rdlc"

    )

    Dim myParam As New ReportParameter("date1"

    , TextBox1.Text)

    myReport.SetParameters(

    New ReportParameter

    () {myParam})

     

     

    but my friend, i dont need a path for the report, the path is already set in the ReportViewer Wizard, i need to access this report viewer from here by accessing ReportViewer1, it already has the data set and the report path

    Thursday, December 8, 2011 4:39 PM
  • User273232671 posted

    No one has an aswer? no one can help me?~! ;(

    Friday, December 9, 2011 6:46 AM
  • User-1528094326 posted

    This will do what you want as far as inserting the parameters for you, however if you are wanting to feed them to to your SQL Statement, then maybe you should just feed them directly into the ObjectDataSource that the ReportViewer generates for your report?

    ReportParameterCollection items = new ReportParameterCollection();
    items.Add(new ReportParameter("Date1", Date1TextBox.Text);
    items.Add(new ReportParameter("Date2", Date2TextBox.Text);
    ReportViewer1.LocalReport.SetParameters(items);
    ReportViewer1.LocalReport.Refresh();
    Monday, December 12, 2011 7:28 PM
  • User9952089 posted

    MishMish, sorry for the delay...but can you try putting your question again in new thread...looks like because of series of out replies..may be no body is paying attention.

    Please repost again.

    Friday, December 16, 2011 11:25 AM