Hi ,How to get data from object source to report viewer.. RRS feed

  • Question

  • Hi,i am developing one application .In that for value in list box i m getting using object source.I need to compare these object source data to data and get the result into reportviewer ..I doing mistake some where .i m placing the code below ..pleas uggest some solution.
    i have a list box and a button .i placing the button click event code here...to get data into list box i m using object source..

    string thisConnectionString =
            string strddl = ObjectDataSource1.ToString();

            SqlConnection Con = new SqlConnection(thisConnectionString);

            SqlCommand Cmd = new SqlCommand("select * from table3 where [col1] ='" + strddl + "'", Con);
            SqlDataAdapter da = new SqlDataAdapter(Cmd);
            System.Data.DataSet ds = new System.Data.DataSet();

            ReportDataSource datasource = new ReportDataSource("DatabaseDataSet_table3", ds.Tables[0]);

            if (ds.Tables[0].Rows.Count == 0)
                // lblMessage.Text = "Sorry, no data under this category!";

    • Moved by Karl ReinschMicrosoft employee Tuesday, June 22, 2010 2:39 PM not related to Workflow Foundation (From:.NET 3.0/3.5 Windows Workflow Foundation)
    Tuesday, June 22, 2010 9:15 AM

All replies

  • Does the RDLC report have a dataset called "DatabaseDataSet_table3" which contains the schema for dsTables[0]?

    The data in ds.Tables[0] needs to match up with the data structure defined in the RDLC report.

    Cephas Lin This posting is provided "AS IS" with no warranties.
    Thursday, June 24, 2010 3:09 AM