在后台
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindShowData();
}
}
protected void BindShowData()
{
ArrayList al = new ArrayList();
string str = "";
try
{
str = "select 列名 from stu_info "
al = PublicClass.SQLSelect(str, 显示项的个数 );
if (al.Count == 11)
{
UNameH.Text = al[0].ToString();
}
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
GridView.DataSource = 你从stu_info表取出的数据;
GridView.DataBind();