private
void
getData()
... {
try
...{
//加載數據庫並綁定數據
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter("proc_selectall", ConfigurationManager.AppSettings["ConnectiontString"].ToString());
da.SelectCommand.CommandType = CommandType.StoredProcedure;
da.SelectCommand.Parameters.Add(new SqlParameter("@CABINET_ID", txCabinetID.Text == string.Empty ? string.Empty : txCabinetID.Text));
da.SelectCommand.Parameters.Add(new SqlParameter("@SECTION_ID", ddlSectionID.Text == string.Empty ? string.Empty : ddlSectionID.Text));
da.SelectCommand.Parameters.Add(new SqlParameter("@BOX_ID", txtBoxID.Text == string.Empty ? string.Empty : txtBoxID.Text));
da.SelectCommand.Parameters.Add(new SqlParameter("@NOTE", txtNote.Text == string.Empty ? string.Empty : txtNote.Text));
da.Fill(ds);
//設置報表定登陸信息
TableLogOnInfo logOnInfo = new TableLogOnInfo();
logOnInfo.ConnectionInfo.ServerName = ConfigurationManager.AppSettings["ServerName"].ToString();
logOnInfo.ConnectionInfo.DatabaseName = ConfigurationManager.AppSettings["DatabaseName"].ToString();
logOnInfo.ConnectionInfo.UserID = ConfigurationManager.AppSettings["UserID"].ToString();
logOnInfo.ConnectionInfo.Password = ConfigurationManager.AppSettings["Password"].ToString();
string path = @"D:GamaniaFD_GAMANIA.rootFD_GAMANIAWebAppReporterCR_4_2.rpt";
ReportDocument oRpt = new ReportDocument();
oRpt.Load(path);
oRpt.Database.Tables[0].ApplyLogOnInfo(logOnInfo);
//該項要設置到具體的表
oRpt.SetDataSource(ds.Tables[0]);
this.CrystalReportViewer1.ReportSource = oRpt;
}
catch (Exception Err)
...{
Response.Write(@"<Script>alert('" + Err.Message + @"')</Script>");
}
}
... {
try
...{
//加載數據庫並綁定數據
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter("proc_selectall", ConfigurationManager.AppSettings["ConnectiontString"].ToString());
da.SelectCommand.CommandType = CommandType.StoredProcedure;
da.SelectCommand.Parameters.Add(new SqlParameter("@CABINET_ID", txCabinetID.Text == string.Empty ? string.Empty : txCabinetID.Text));
da.SelectCommand.Parameters.Add(new SqlParameter("@SECTION_ID", ddlSectionID.Text == string.Empty ? string.Empty : ddlSectionID.Text));
da.SelectCommand.Parameters.Add(new SqlParameter("@BOX_ID", txtBoxID.Text == string.Empty ? string.Empty : txtBoxID.Text));
da.SelectCommand.Parameters.Add(new SqlParameter("@NOTE", txtNote.Text == string.Empty ? string.Empty : txtNote.Text));
da.Fill(ds);
//設置報表定登陸信息
TableLogOnInfo logOnInfo = new TableLogOnInfo();
logOnInfo.ConnectionInfo.ServerName = ConfigurationManager.AppSettings["ServerName"].ToString();
logOnInfo.ConnectionInfo.DatabaseName = ConfigurationManager.AppSettings["DatabaseName"].ToString();
logOnInfo.ConnectionInfo.UserID = ConfigurationManager.AppSettings["UserID"].ToString();
logOnInfo.ConnectionInfo.Password = ConfigurationManager.AppSettings["Password"].ToString();
string path = @"D:GamaniaFD_GAMANIA.rootFD_GAMANIAWebAppReporterCR_4_2.rpt";
ReportDocument oRpt = new ReportDocument();
oRpt.Load(path);
oRpt.Database.Tables[0].ApplyLogOnInfo(logOnInfo);
//該項要設置到具體的表
oRpt.SetDataSource(ds.Tables[0]);
this.CrystalReportViewer1.ReportSource = oRpt;
}
catch (Exception Err)
...{
Response.Write(@"<Script>alert('" + Err.Message + @"')</Script>");
}
}