.rdlc Report - Cannot create a data reader for dataset 'DataSet1'
Solution 1
I have same problem that "Cannot create a data reader for dataset 'zzz'"
The answer is ReportDataSource(string xxx, DataTable yyy)
You should use the right name. xxx should be zzz
Solution 2
My 'gotcha' was the discovery that DataSet was not the same as Dataset.
Solution 3
You have to give "DataSet1", otherwise it will not work.
Solution 4
You unable to create ReportViewer and providing true dataset. It's possible you are getting the error due to parameter providing technique
You can try like this; I solved by using this way:
protected void btnPdf_Click(object sender, EventArgs e)
{
ReportViewer viwer = new ReportViewer();
ObjectDataSource ob = new ObjectDataSource("dataset.YourTableAdapter", "GetData");
dataset.YourTableAdapter ds = new dataset.YourTableAdapter();
string PDF = "PDF";
string ReportType = "ReportType";
Warning[] warnings = null;
string[] streamIds = null;
string mimeType = string.Empty;
string encoding = string.Empty;
string extension = string.Empty;
string filetype = string.Empty;
viwer.SizeToReportContent = true;
viwer.LocalReport.ReportPath = "reports/report/report.rdlc";
viwer.ProcessingMode = ProcessingMode.Local;
ob.SelectParameters.Clear();
ob.SelectParameters.Add(QueryStringEnum.CompanyID, CurrentCompanyID.ToString());
ReportDataSource rds = new ReportDataSource("datasetname", (object) ds.GetData((long?)CurrentCompanyID.ToInt64());
viwer.LocalReport.DataSources.Add(rds);
viwer.LocalReport.Refresh();
byte[] bytes = viwer.LocalReport.Render("PDF", null,
out mimeType, out encoding, out extension, out streamIds, out warnings);
}
Solution 5
-
Make sure that you are running on administrator mode and you have access to the SSRS server.
-
Verify if you have set the correct dataset name or if you are properly loading and assigning it.
Please check this sample on MSDN.
![Thomas](https://i.stack.imgur.com/gp4Aw.png?s=256&g=1)
Thomas
Hi! I'm Thomas. Currently Full Stack Developer at hobex payment systems ...
Updated on March 03, 2021Comments
-
Thomas over 3 years
I have created a .rdlc-Report under VS 2012 using the report wizard and added data source and dataset. When I try to render the report using the code below I get following error message:
Cannot create a data reader for dataset 'DataSet1'.
bytes = localReport.Render("PDF", sdeviceinfo, out smimetype, out sencoding, out sfilenameextension, out streamids, out myWarnings);