void AdvanceSearch1_OnMySearchClick(object sender, EventArgs e) { ZcMng1_AdvanceSearch search1 = sender as ZcMng1_AdvanceSearch; if (search1 != null) { List <SearchField> list1 = search1.SearchConditon; list1.Add(new SearchField(String.Format("(zeren1='{0}' or zeren2='{0}')", User.Identity.Name), "", SearchOperator.用户定义)); U_ZCBU Zc1 = new U_ZCBU(); DataSet ds1 = Zc1.GetMyZcInfo(list1); string zcid = ""; if (ds1.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) { if (i == 0) { zcid = ds1.Tables[0].Rows[i]["id"].ToString(); } else { zcid = zcid + "," + ds1.Tables[0].Rows[i]["id"].ToString(); } } } Session["Myzcid"] = zcid; this.GridView1.DataSource = ds1; this.GridView1.DataBind(); ds1.Dispose(); Zc1.Close(); } }