1
根據FastReport.Net文檔,RegisterData方法已經過載,我可以通過多種方式註冊數據。我試圖通過下面的代碼來註冊數據集:FastReport.Net。註冊數據時出錯
adapter.SelectCommand.CommandText = "SELECT t.* FROM test t";
ds = new DataSet();
adapter.Fill(ds);
report1.Load("report1.frx");
report1.RegisterData(ds, "user_ds");
report1.GetDataSource("user_ds").Enabled = true; //Error: Object reference not set to an instance of an object.
((DataBand)report1.FindObject("Data1")).DataSource = report1.GetDataSource("user_ds");
report1.Show();
,並得到錯誤:
Object reference not set to an instance of an object.
,但我得到的成功,當寄存器數據表:
adapter.SelectCommand.CommandText = "SELECT t.* FROM test t";
ds = new DataSet();
adapter.Fill(ds, "test");
report1.Load("report1.frx");
report1.RegisterData(ds.Tables["test"], "user_ds");
report1.GetDataSource("user_ds").Enabled = true;
((DataBand)report1.FindObject("Data1")).DataSource = report1.GetDataSource("user_ds");
report1.Show();
爲什麼我就't註冊數據集?
我遇到錯誤 「(GroupHeader1):錯誤CS1525:無效的表達術語 '['」 爲您的代碼...但我有GroupHeader1單TextObject與 「[日期]」和我的代碼它的工作 – GrApDev
錯誤行「report1.Show();」 – GrApDev
見[FastReport.Net。數據集的註冊](http://stackoverflow.com/questions/41179788/fastreport-net-registration-of-dataset) – GrApDev