asp.net分页问题
如何在下列代码中实现,进行if判断如果单击的是button1则执行的是一条sql语句,如果单击的是button2执行的是另外一条sql语句,谢谢protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
string cond = " and 进仓编号 like " + "'%" + TextBox1.Text.ToString() + "%'";
string sql = "select distinct(进仓编号),仓库 from ck_进仓主表 zb inner join ck_进仓明细 mx on zb.进仓主键=mx.进仓主键" + cond;
string connString = ConfigurationManager.ConnectionStrings["DepotConnectionString"].ToString();
SqlConnection conn = new SqlConnection(connString);
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = new SqlCommand(sql, conn);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.AllowPaging = true;
GridView1.PageSize = 20;
GridView1.DataBind();
conn.Close();