Results 1 to 5 of 5

Thread: Help with Report Viewer

  1. #1

    Thread Starter
    Member Cyrax.NET's Avatar
    Join Date
    Feb 2007
    Posts
    54

    Question Help with Report Viewer

    Hi thanks for taking a look.

    I need some insight into MS Report Viewer and how I can make it work for what I need. I have looked and trawled through many articles but still cant make it work.

    -----
    I have a form, on it I have added Report Viwer component. I select 'Design New Report' from Reportviewer tasks. I use the wizard to create a basic report by selecting all fields in my payments table from sql.
    I tell report viwer to use the newly created report and VS adds the dataset, table adapter and binding source for me. when i run it, it displays all the records from the payments table. All ok.

    Now i want to know how to modify/create a report so as to filter the data to only show payments from a certain MemberID. MemberID is also a field in the payments table.

    Do I need to filter the datatable, binding source or table adapter?
    I keep reading about passing a parameter to the report but am not sure how to do this? I noticed i can change the query the table adapter is using to a custom one, is this the correct way to go?

    My end aim is to have a textbox on my form, user enters the memberID, presses search, and up pops a report with only payments from that member.

    Any help would be greatly appreciated as I have admitted defeat on my own strengths. One example, step by step would be enough to get me going.


    Thanks again!

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Help with Report Viewer

    When I did this, I filtered on the bindingsource. I was not using datasets, I was using LINQ2SQL, but I don't see why the same would not apply. That isn't to say you can't filter somewhere else along the line, but filtering the bindingsource should work for you.

  3. #3

    Thread Starter
    Member Cyrax.NET's Avatar
    Join Date
    Feb 2007
    Posts
    54

    Re: Help with Report Viewer

    kleinma am assuming your talking about using the filter property of the binding source. i tried to create an expression but it didnt see to work.

    can you give me example expression for displaying only memberID matching a given input from user. how would i make it dynamic at runtime i.e. memberID supplied at runtime from textbox into the expression???

    ---------

    alternativily i been trying to filter using queries. i.e. supply the table adapter with filtering query using dynamic values supplied at runtime.

    Code:
        Dim attendanceTable As DataTable
    
        Public Function PopulateQueryData(ByVal memberID1In As Integer, ByVal memberID2In As Integer, ByVal dateStartIn As Date, ByVal dateEndIn As Date)
    
            attendanceTable = AttendancesTableAdapter.GetAttendanceNoTypeReport(memberID1In, memberID2In, dateStartIn, dateEndIn)
    
            Me.AttendancesTableAdapter.Fill(attendanceTable)
    
            Me.ReportViewer1.RefreshReport()
    
        End Function

    The above method returns a data table, using query that filters between 2 member id's and date range. I know the query is ok as ive tested it but the the report viewer does not display any records. I have stopped execution and can see just before i refresh the reportviwer, attendanceTable has the correct rows in store.

    Can anyone see what am doing wrong. am guessing something to do with the fill method of the adapter.


    Thanks in advance

  4. #4
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Help with Report Viewer

    No in my situation I was setting the binding source to an already filtered table of my data.

  5. #5

    Thread Starter
    Member Cyrax.NET's Avatar
    Join Date
    Feb 2007
    Posts
    54

    Re: Help with Report Viewer

    anyone else with any insight can help?

    or can someone point me to a decent article on report building for begginers? how do the rest of you make reports with .net??? crystal?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width