protected void MyBind() { dt = dtlist.Sel(); if (dt != null && dt.Rows.Count > 0) { EGV.Visible = true; Link2.Visible = true; } else { this.EGV.Visible = false; Link2.Visible = false; } string skey = Search_T.Text.Replace(" ", ""); SqlParameter[] sp = new SqlParameter[] { new SqlParameter("type", Request["type"]), new SqlParameter("skey", "%" + skey + "%") }; string where = ""; //if (!string.IsNullOrEmpty(Request["type"])) //{ // sqlstr += " And Type=@type"; //} if (!string.IsNullOrEmpty(skey)) { where += " And Explain LIKE @skey OR TableName LIKE @skey"; } dt = SqlHelper.ExecuteTable("SELECT * FROM ZL_DataList WHERE 1=1 " + where, sp); EGV.DataSource = dt; EGV.DataBind(); }
protected void ShowDatas() { B_DataList bll = new B_DataList(); DataTable dt = bll.Sel(); string str = ""; if (dt.Rows.Count > 0) { string[,] arr = new string[dt.Rows.Count, 4]; for (int i = 0; i < dt.Rows.Count; i++) { arr[i, 0] = dt.Rows[i]["ThrShort"].ToString(); arr[i, 1] = dt.Rows[i]["Explain"].ToString(); arr[i, 2] = dt.Rows[i]["TableName"].ToString(); arr[i, 3] = dt.Rows[i]["SecShort"].ToString(); str += "citys[" + i + "]=new Array('" + arr[i, 0] + "','" + arr[i, 1] + "','" + arr[i, 2] + "','" + arr[i, 3] + "');"; } } ViewState["dataArr"] = "var citys=new Array();" + str; }