一个reportViewer的问题
我在一个页面里加个了一个reportViewer,没有指定它指向那一个RDLC,我在程序中指定它的RDLC:
SqlConnection cnn = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["conn"]);
string sql = @"SELECT authors.au_lname + ' ' + authors.au_fname AS 'Author name', titles.title, titles.type,
titles.price, titles.pubdate
FROM authors INNER JOIN
titleauthor ON authors.au_id = titleauthor.au_id INNER JOIN
titles ON titleauthor.title_id = titles.title_id";
SqlDataAdapter da = new SqlDataAdapter(sql, cnn);
DataSet ds = new DataSet();
da.Fill(ds, "authorBookList");
DataTable dt = ds.Tables["authorBookList"];
Microsoft.Reporting.WebForms.ReportDataSource rd = new Microsoft.Reporting.WebForms.ReportDataSource();
rd.Name = "author_book";
rd.Value = ds.Tables["authorBookList"];
rv1.LocalReport.DataSources.Add(rd);
rv1.LocalReport.ReportEmbeddedResource = "Report1.rdlc";
rv1.LocalReport.ReportPath = "Report1.rdlc";
cnn.Close();
da.Dispose();
ds.Dispose();
执行时出现如下出错信息:
本地报表处理期间出错。
报表“主报表”的定义无效。
表“table_1”引用了无效的 DataSetName“author_book”。
我解如何办,请各位帮忙。