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

首頁 > 編程 > .NET > 正文

.NET 水晶報表使用代碼

2024-07-10 12:39:02
字體:
來源:轉載
供稿:網友
需要的命名空間
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 = "";
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 富源县| 阿鲁科尔沁旗| 内丘县| 三亚市| 昌吉市| 泗洪县| 洛浦县| 南宁市| 比如县| 岚皋县| 共和县| 察隅县| 大关县| 太康县| 科技| 闵行区| 香港 | 金门县| 津南区| 南丰县| 盈江县| 宝鸡市| 巴塘县| 新和县| 炎陵县| 蓝山县| 金溪县| 马山县| 铜山县| 沛县| 垦利县| 新津县| 潢川县| 若羌县| 南宫市| 馆陶县| 宁波市| 乌兰浩特市| 噶尔县| 梅州市| 大丰市|