⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webprintpreview.aspx.cs

📁 基于web的图书管理系统 (SQL Server 2000)
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace WebApplication1
{
	/// <summary>
	/// WebPrintPreview 的摘要说明。
	/// </summary>
	public class WebPrintPreview : System.Web.UI.Page
	{protected CCUtility Utility;
		private Access acc=new Access();
		private DataSet ds=new DataSet();
		protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1;
		public void MsgBox( string msg )
		{
			string strScript =  "<script language='Javascript'>alert('" + msg + "');</script>";
			Page.RegisterStartupScript("alert", strScript);
		}
		private void Page_Load(object sender, System.EventArgs e)
		{
				this.Utility=new CCUtility(this);
			Utility.CheckSecurity();
			
			System.Collections.Specialized.StringDictionary Params =new System.Collections.Specialized.StringDictionary();	
			if(!Params.ContainsKey("strsql"))
			{
				string temp="";//Utility.GetParam("strsql");
				Params.Add("strsql",temp);
			}
			
			string strsql = Utility.GetParam("strsql");	
			if(strsql==""){this.MsgBox("未查到相关数据!");return;}
			acc.GetDataSet(strsql,ds);
			CrystalReport1 mycrt=new CrystalReport1();
			DataSet1 myds=new DataSet1();
			for(int count=0;count<ds.Tables[0].Rows.Count;count++)
			{
				DataRow mydr=myds.Tables[0].NewRow();
				mydr[0]=ds.Tables[0].Rows[count]["BookID"].ToString();
				mydr[1]=ds.Tables[0].Rows[count]["BookName"].ToString();
				mydr[2]=ds.Tables[0].Rows[count]["type"].ToString();
				mydr[3]=ds.Tables[0].Rows[count]["TPI"].ToString();
				mydr[4]=ds.Tables[0].Rows[count]["Writer"].ToString();
				mydr[5]=ds.Tables[0].Rows[count]["Price"].ToString();
				mydr[6]=ds.Tables[0].Rows[count]["pDate"].ToString();
				mydr[7]=ds.Tables[0].Rows[count]["memo"].ToString();
				mydr[8]=ds.Tables[0].Rows[count]["state"].ToString();
				
				myds.Tables[0].Rows.Add(mydr);
			}

			mycrt.SetDataSource(myds);
			this.CrystalReportViewer1.ReportSource=mycrt;
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -