c# winform 怎么使用DataGridView 的垂直滚动条实现不同条件的分页效果

2024-12-14 13:45:13
推荐回答(1个)
回答1:

SqlConnection con = new SqlConnection(GZSoft.Web.GZBasic.GetWebConfigString("GZSoftConn"));
string sql = "1=1 ";
if (SQLStr.Trim() != "")
{
sql += SQLStr;
}
SqlDataAdapter dr = new SqlDataAdapter("select * from Basic_View_115Apply where " + sql + " order by " + ddlCompositor.SelectedValue+" "+ddlorderBy.SelectedValue, con);
DataSet ds = new DataSet();
DataSet ds2 = new DataSet();
dr.Fill(ds2);
dr.Fill(ds, 1, 15, "tab1");//前15条
this.gvTab.DataSource = ds.Tables[0];
this.gvTab.DataBind();