none
manual report help RRS feed

  • Question

  • Hi,
    I am trying to do a report manually. I've followed some procedures:
    - Create a dataset and a datatable on designer;
    - Construct the report (rdl) and set the proper datasource;
    - Then  run the report and it was just fine;

    Now i want to create it manually so:

    - I've deleted the tableadapter auto created on designer;

    Then i used this code:

    Dim sqlConn As OleDb.OleDbConnection = New OleDb.OleDbConnection("Provider=IBOLE.Provider.v4;Data Source=c:\praia.fdb;Persist Security Info=True;User ID=sysdba")
            Dim Dataset1 As DataSet
            Dim squery As String = " SELECT * FROM ..."

            Dim TestTableAdapter As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(squery, sqlConn)
            TestTableAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey
            TestTableAdapter.Fill(Dataset1, "Test")
            ReportViewer1.LocalReport.DataSources.Clear()
            ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("DataSet1_Test", DataSet1.Tables(0)))
            ReportViewer1.LocalReport.Refresh()


    And it returns me an error:
    Error: System.ArgumentNullException was unhandled
          Parameter name: dataSet

    If i delete the green line, it runs but the report just show the header!!

    Information about my dataset on designer:

    Dataset = DataSet1
    TableAdapter = TestTableAdapter
    DataTable = Test
    DataSource = DataSet1_Test


    Any ideas about what i am doing wrong?

    Thanks



    Friday, January 11, 2008 3:01 PM

Answers


  • The solution is on this link:

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2683559&SiteID=1&mode=1
    Tuesday, January 15, 2008 10:05 AM

All replies

  • You might find the answer in a walkthrough I wrote here: http://spacefold.com/lisa/post/Dynamically-loading-reports-in-ReportViewers.aspx

     

    ... but one thing to realize is that you can't really do this "half automagic and half manual" without getting into a heap of trouble.  That's because the designer puts lots more code into the original version you are trying to "fix/edit" than you might notice right away.


    So one thing to do is to look in the designer code and see if there is anything else you may have missed on in deleting.  If there isn't, there *was* something else that you *already* deleted that you have not yet succeeded in properly recreating <g>.

     

    In your current code, you have declared a dataset but you have not actually created a dataset by that line in green. You've just declared its type.  You have to use the New keyword to actually create an instance of the dataset.  I'm not sure that is the only thing that is missing, however...

     

    >L<

    Monday, January 14, 2008 1:43 AM

  • The solution is on this link:

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2683559&SiteID=1&mode=1
    Tuesday, January 15, 2008 10:05 AM