0
我試圖做到的是有一個好看的報表供用戶打印出來。所以我現在正在使用SQL Server來獲取我的數據,我想將它放在我的報告查看器中。我擔心它會看起來很糟糕,並且使整件事情浪費時間。最理想的是製作一份報告,看起來像一個可以使用報告應用程序創建的報告,但是可以基於網絡。例如在他們的Intranet系統上,他們打開一個Web瀏覽器,然後轉到報告。我怎樣才能做到這一點?如果您有更好的解決方案或知道如何製作更好的基於網絡的報告,我很樂意提供建議。發送一個數據集的ReportViewer顯示
這是我在這個解決方案當前的嘗試:
SqlCommand sqlString = new SqlCommand("SELECT WorkOrderNumber, LNumber FROM WorkOrder ");
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter();
sqlString.CommandType = CommandType.Text;
sqlString.Connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
da.SelectCommand = sqlString;
da.Fill(ds, "DataSet1");
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", ds.Tables[0]));
ReportViewer1.LocalReport.Refresh();