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;

using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page 
{
    private DataTable dt = new DataTable();

    private SqlConnection CreatConnection()
    {
        SqlConnection connection = new SqlConnection();
        connection.ConnectionString = "Persist Security Info=False;Integrated Security=SSPI;Initial Catalog=MysqlData;server=(local)";
        return connection;
    }

    private void BindList()//绑定控件
    {
        this.GridView1.DataSource = dt;
        this.GridView1.DataBind();
    }


    protected void Page_Load(object sender, EventArgs e)
    {
        this.GridView1.DataKeyNames = new string[] { "供应商编号" };//设置主键字段 
        SqlDataAdapter adapter = new SqlDataAdapter("select * from 应付账", CreatConnection());
        adapter.Fill(dt);
        if (!IsPostBack)
        {
            BindList();
        }
    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        this.GridView1.PageIndex = e.NewPageIndex;
        BindList();
    }
}
