using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class _Default : System.Web.UI.Page 
{
    public double   mjmax, mjmin, mjavg, mjsum, ckcount;
    protected void Page_Load(object sender, EventArgs e)
    {
        string connectionString = "Data Source=zf;Initial Catalog=SQL_Data;Integrated Security=True";
        DataClassesDataContext db = new DataClassesDataContext(connectionString);
        var result = from r in db.仓库
                     select r;
        mjmax = result.Max(r => r.面积.Value);
        mjmin = result.Min(r => r.面积.Value);
        mjavg = result.Average(r => r.面积.Value);
        mjsum = result.Sum(r => r.面积.Value);
        ckcount = result.Count();
        GridView1.DataSource = result;
        GridView1.DataBind();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        TextBox1.Text = mjmax.ToString ();
        TextBox2.Text = mjmin.ToString();
        TextBox3.Text = mjavg.ToString();
        TextBox4.Text = mjsum.ToString();
        TextBox5.Text = ckcount.ToString();
        Panel1.Visible = true;
    }
}
