default.aspx.cs
来自「水晶报表详细资料水晶报表详细资料水晶报表详细资料」· CS 代码 · 共 32 行
CS
32 行
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection myConn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"].ToString());
string strSqlAll = "select * from tb_Employee";
string strSqlGroup = "select 员工性别,avg(员工工资) as '平均工资' from tb_Employee Group by 员工性别 ";
SqlDataAdapter adapterAll = new SqlDataAdapter(strSqlAll, myConn);
DataSet dsAll = new DataSet();
adapterAll.Fill(dsAll);
this.GridView1.DataSource = dsAll.Tables[0].DefaultView;
this.GridView1.DataBind();
SqlDataAdapter adapterGroup = new SqlDataAdapter(strSqlGroup, myConn);
DataSet dsGroup = new DataSet();
adapterGroup.Fill(dsGroup);
this.GridView2.DataSource = dsGroup.Tables[0].DefaultView;
this.GridView2.DataBind();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?