日期:2014-05-20 浏览次数:21008 次
ds_jieY myds = new ds_jieY(); //数据集对象。XSD cp_jieY myreport = new cp_jieY(); //报表文件 //借阅报表数据初始化 try { DataRow dr_jyr; dr_jyr = myds.Tables["JYR"].NewRow(); dr_jyr["jieyr"] = jyr; dr_jyr["jieyrq"] = rq; dr_jyr["yinhsj"] = Convert.ToString(rq.AddDays(Convert.ToInt16(ts))); dr_jyr["jieydw"] = dw; dr_jyr["jieyyy"] = yy; dr_jyr["tel"] = tel; myds.Tables["JYR"].Rows.Add(dr_jyr); if (list_jiey.Items.Count > 0) { string strSql_JY = ""; DataRow dr_jyba; string[] str = new string[3]; for (int i = 0; i < list_jiey.Items.Count; i++) { str = list_jiey.Items[i].ToString().Split('、'); strSql_JY = "select bingabh,chuykb,bingrxm,chuyrq from view_search2 where bingabh='" + str[0] + "'and subhosp=" + subhosp + ""; dt_ba = DbHelperSQL.Query(strSql_JY).Tables[0]; if (dt_ba.Rows.Count > 0) { dr_jyba = myds.Tables["JYBA"].NewRow(); dr_jyba["bingabh"] = dt_ba.Rows[0]["bingabh"].ToString().Trim(); dr_jyba["chuykb"] = dt_ba.Rows[0]["chuykb"].ToString(); dr_jyba["chuyrq"] = dt_ba.Rows[0]["chuyrq"].ToString(); dr_jyba["bingrxm"] = dt_ba.Rows[0]["bingrxm"].ToString(); myds.Tables["JYBA"].Rows.Add(dr_jyba); } } list_jiey.Items.Clear(); myreport.SetDataSource(myds); crpView_jieY.ReportSource = myreport;//crpView_jieY 为crystalreportviewer 控件 crpView_jieY.PrintReport(); } } catch (Exception ex) { this.Cursor = Cursors.Default; MessageBox.Show("系统错误:" + ex.ToString(), "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; }