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

📄 applicationdataset.aspx.cs

📁 基于sqlserver2k,reporting service的扩展(auth,render,deliver==)应用(mssql,RS,AS,BI)
💻 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;
using System.Configuration;

namespace AWC.Reporter.Web.Server
{
	/// <summary>
	/// Summary description for ApplicationDataset.
	/// </summary>
	public class ApplicationDataset : System.Web.UI.Page
	{
		protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter;
		protected System.Data.SqlClient.SqlConnection sqlConnection;
		protected AWC.Reporter.Web.Entities.SalespersonSummary salespersonSummary;
		protected AWC.Reporter.Web.AwReportViewer.AwReportViewer reportViewer;
		protected System.Web.UI.WebControls.LinkButton lnkRun;
		protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;
		protected System.Data.SqlClient.SqlCommand sqlSelectCommand;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here
			
		}
		private void lnkRun_Click(object sender, System.EventArgs e)
		{
			RenderReport();
		}

		private void RenderReport()
		{
			// get the dataset
			salespersonSummary = new AWC.Reporter.Web.Entities.SalespersonSummary();
			sqlConnection.ConnectionString = ConfigurationSettings.AppSettings[Constants.CONFIG_CONNECT_STRING];
			sqlDataAdapter.Fill(salespersonSummary);
			// bind the dataset to the report viewer
			reportViewer.DataSource = salespersonSummary;
			reportViewer.Visible = true;
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.sqlDataAdapter = new System.Data.SqlClient.SqlDataAdapter();
			this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
			this.sqlConnection = new System.Data.SqlClient.SqlConnection();
			this.salespersonSummary = new AWC.Reporter.Web.Entities.SalespersonSummary();
			((System.ComponentModel.ISupportInitialize)(this.salespersonSummary)).BeginInit();
			this.lnkRun.Click += new System.EventHandler(this.lnkRun_Click);
			// 
			// sqlDataAdapter
			// 
			this.sqlDataAdapter.SelectCommand = this.sqlSelectCommand1;
			this.sqlDataAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
																									 new System.Data.Common.DataTableMapping("Table", "Employee", new System.Data.Common.DataColumnMapping[] {
																																																				 new System.Data.Common.DataColumnMapping("EmployeeID", "EmployeeID"),
																																																				 new System.Data.Common.DataColumnMapping("EmployeeName", "EmployeeName"),
																																																				 new System.Data.Common.DataColumnMapping("Title", "Title"),
																																																				 new System.Data.Common.DataColumnMapping("HireDate", "HireDate"),
																																																				 new System.Data.Common.DataColumnMapping("Sales", "Sales"),
																																																				 new System.Data.Common.DataColumnMapping("NoOrders", "NoOrders"),
																																																				 new System.Data.Common.DataColumnMapping("Year", "Year"),
																																																				 new System.Data.Common.DataColumnMapping("Month", "Month")})});
			// 
			// sqlSelectCommand1
			// 
			this.sqlSelectCommand1.CommandText = @"SELECT E.EmployeeID, E.LastName + N', ' + E.FirstName AS EmployeeName, E.Title, E.HireDate, SUM(SOD.UnitPrice * SOD.OrderQty) AS Sales, COUNT(SOH.SalesOrderID) AS NoOrders, DATEPART(yy, SOH.OrderDate) AS Year, DATEPART(m, SOH.OrderDate) AS Month FROM SalesPerson SP INNER JOIN SalesOrderHeader SOH ON SP.SalesPersonID = SOH.SalesPersonID INNER JOIN Employee E ON SP.SalesPersonID = E.EmployeeID INNER JOIN SalesOrderDetail SOD ON SOH.SalesOrderID = SOD.SalesOrderID WHERE (SOH.OrderDate BETWEEN DATEADD(mm, - 12, '1/1/2004') AND '1/1/2004') AND (E.EmployeeID = 23) GROUP BY E.EmployeeID, E.LastName + N', ' + E.FirstName, DATEPART(m, SOH.OrderDate), DATEPART(yy, SOH.OrderDate), E.Title, E.HireDate ORDER BY DATEPART(yy, SOH.OrderDate), DATEPART(m, SOH.OrderDate)";
			this.sqlSelectCommand1.Connection = this.sqlConnection;
			// 
			// sqlConnection
			// 
			this.sqlConnection.ConnectionString = "integrated security=SSPI;data source=\".\";persist security info=False;initial cata" +
				"log=AdventureWorks2000";
			// 
			// salespersonSummary
			// 
			this.salespersonSummary.DataSetName = "SalespersonSummary";
			this.salespersonSummary.Locale = new System.Globalization.CultureInfo("en-US");
			this.Load += new System.EventHandler(this.Page_Load);
			((System.ComponentModel.ISupportInitialize)(this.salespersonSummary)).EndInit();

		}
		#endregion




	}
}

⌨️ 快捷键说明

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