国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

.NET 水晶報表使用代碼

2020-01-18 01:19:19
字體:
來源:轉載
供稿:網友
需要的命名空間
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Web;
using CrystalDecisions.Shared;
----------------------------------------------------
建一個數據集文件
*.xsd
-----------------------------------------------------
在頁面中加一個報表查看控件
CrystalReportViewer
--------------------------------------------------------
后臺代碼
dsJob dsjob = new dsJob();
SqlConnection scn = new SqlConnection("server=.;uid=sa;pwd=111111;database=pubs;");
scn.Open();
SqlDataAdapter sda = new SqlDataAdapter("select * from jobs", scn);
DataSet ds = new DataSet();
sda.Fill(ds);
if (ds != null && ds.Tables[0].Rows.Count > 0)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
DataRow drjob = dsjob.Tables[0].NewRow();
drjob["job_id"] = dr["job_id"];
drjob["job_desc"] = dr["job_desc"];
dsjob.Tables[0].Rows.Add(drjob);
}
}
CrystalReportSource crysource = new CrystalReportSource();
crysource.ReportDocument.Load(Server.MapPath("CryPort.rpt"));
crysource.ReportDocument.SetDataSource(dsjob);
crysource.DataBind();
cryview.ReportSource = crysource;
cryview.DataBind();
//給報表上的 text 控件賦值
TextObject txtname = (TextObject)crysource.ReportDocument.ReportDefinition.ReportObjects["控件Name"];
txtname.Text = "";
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 洞头县| 长寿区| 灌南县| 镇康县| 镇江市| 军事| 黑龙江省| 武隆县| 扶余县| 平舆县| 景洪市| 进贤县| 兴山县| 涞源县| 泰来县| 四川省| 抚松县| 丰顺县| 阆中市| 巨野县| 独山县| 阿勒泰市| 开江县| 虹口区| 小金县| 合山市| 松桃| 乃东县| 柯坪县| 大邑县| 广汉市| 兴化市| 清流县| 江口县| 灯塔市| 靖边县| 旌德县| 镇远县| 宣威市| 登封市| 西乡县|