0
數據源實例尚未提供給數據源'dataset1'。這出現在我的報告查看器中。未知數據源
private void button1_Click(object sender, EventArgs e)
{
DataSet1 dataSet = new DataSet1();
DataTable table = dataSet.Tables.Add("Language");
table.Columns.Add("A1", Type.GetType("System.String"));
table.Columns.Add("A2", Type.GetType("System.String"));
table.Columns.Add("A3", Type.GetType("System.String"));
DataRow row;
row = table.NewRow();
row["A1"] = textBox1.Text;
row["A2"] = textBox2.Text;
row["A3"] = textBox3.Text;
table.Rows.Add(row);
//table.Fill(dataSet, "Language");
// MyReport.ProcessingMode = MyReport.Local;
MyReport.LocalReport.DataSources.Clear();
MyReport.LocalReport.DataSources.Add(new ReportDataSource("DT", dataSet.Tables[1]));
// MyReport.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource());
//MyReport.LocalReport.DataSources.Add(new ReportDataSource("DT", table));
MyReport.LocalReport.Refresh();
MyReport.RefreshReport();
}
感謝ü烏拉圭回合的幫助,但之後,我在我的項目寫我們的代碼我面臨的另一個問題。這個錯誤是「本地報表等待處理期間eccurred錯誤」 – Elmohands
感謝ü @Taosique爲你的幫助,但我面臨另一個問題,當我寫你的代碼在我的代碼中的錯誤是「你的本地報告進程中發生的錯誤」終於需要它快速解釋reportViewer不Cristalreport沒有數據庫 使它從一些控件(2文本框,1 datetimpeaker,1Compobox)沒有數據庫我今天需要它,如果你能和我感謝你的青睞 – Elmohands