locked
getting error while generating report using reportviewer RRS feed

  • Question

  • i am making web application using C#   , asp.net ,sql2000 ( visual studio 2005).

    i am using following code on button_click

    protected void Button1_Click(object sender, EventArgs e)

    {

           ReportViewer1.Visible = true;

           setting = ConfigurationManager.ConnectionStrings["NorthwindConnectionString"];

           if (setting != null)

             {

                  conn = new SqlConnection(setting.ConnectionString);

                   cmd = new SqlCommand("ShowProductByCategory", conn);

                   cmd.CommandType = CommandType.StoredProcedure ;

                    cmd.Parameters.Add("@CategoryName", SqlDbType.VarChar);

                    cmd.Parameters["@CategoryName"].Value = DropDownList1.SelectedItem.Text;

                     da = new SqlDataAdapter(cmd);

                     ds = new DataSet();

                      da.Fill(ds, "datas" );

           ReportDataSource datasourse = new ReportDataSource("datasetprodiuct",ds.Tables["datas"]) ;

     //datasourse.Value = ds;

    //ReportViewer1.LocalReport.DataSources.Clear();

    ReportViewer1.LocalReport.DataSources.Add(datasourse) ;

    if (ds.Tables["datas"].Rows.Count == 0)

    {

    lblmessage.Text = "sorry";

    }

    //ReportViewer1.LocalReport.Refresh();

    }

    }

    i am trying to generate report using reportviewer but getting following error

  • An error has occurred during report processing.
  • ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'GetData' that has no parameters.
  • Please help.

    thanks

Friday, March 9, 2007 9:38 AM

Answers