c# gridview绑定数据源的问题?有大神么,很简单的问题

2024-11-15 12:57:10
推荐回答(2个)
回答1:

SqlDataSource sqlDataSource1 = new SqlDataSource
("server=(local);uid=sa;pwd=1234qwer;database=project;", "select * from Student");

SqlDataSource sqlDataSource2= new SqlDataSource
("server=(local);uid=sa;pwd=1234qwer;database=project;", "select * from Score");

protected void Button1_Click(object sender, EventArgs e)
{
girdview1.DataSource = sqlDataSource1;
girdview1.DataBind();
}

protected void Button2_Click(object sender, EventArgs e)
{
girdview1.DataSource = sqlDataSource2;
girdview1.DataBind();
}

回答2:

gridview1.count --- 有这个属性?