string strConnection = ConfigurationManager.ConnectionStrings["ConnectionString2"].ToString(); DataSet myDs = new Report1(); using (SqlConnection conn = new SqlConnection(strConnection)) { conn.Open(); string strSQL = "select * from XXXX"; using (SqlCommand cmd = new SqlCommand(strSQL, conn)) { SqlDataReader myDr = cmd.ExecuteReader(); myDs.Tables["statlist"].Load(myDr); myDr.Close(); myDr.Dispose(); } } //將ReportViewer1的DataSources集合清除 ReportViewer1.LocalReport.DataSources.Clear(); //匯出檔案名稱 ReportViewer1.LocalReport.DisplayName = "XXX彙總表"; //為查看器提供本地報表數據 ReportViewer1.LocalReport.ReportPath = Server.MapPath("Report1.rdlc"); ReportViewer1.LocalReport.DataSources.Add( new Microsoft.Reporting.WebForms.ReportDataSource("Report1_statlist", myDs.Tables["statlist"])); //參數 //ReportParameter param = new ReportParameter("Title", "嗚嗚"); //ReportPara...