/// <summary> /// 条件查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { Business.Users.User tjuser = new Business.Users.User(); DataTable usersj = new DataTable(); if (this.TextBoxXH.Text == "" && this.TextBoxXM.Text == "") { usersj = tjuser.GetUserList(""); } else if (this.TextBoxXH.Text != "" && this.TextBoxXM.Text != "") { string sqltj = " where Sno like '"+this.TextBoxXH.Text+"%' and Name like '"+this.TextBoxXM.Text+"%'"; usersj = tjuser.GetUserList(sqltj); } else if (this.TextBoxXH.Text != "" && this.TextBoxXM.Text == "") { string sqltj = " where Sno like '" + this.TextBoxXH.Text + "%'"; usersj = tjuser.GetUserList(sqltj); } else if (this.TextBoxXH.Text == "" && this.TextBoxXM.Text != "") { string sqltj = " where Name like '" + this.TextBoxXM.Text + "%'"; usersj = tjuser.GetUserList(sqltj); } this.LabelInfo.Text = "共有用户数据" + usersj.Rows.Count + "条"; this.GridView1.DataSource = usersj; GridView1.DataBind(); }
/// <summary> /// 条件查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { Business.Users.User tjuser = new Business.Users.User(); DataTable usersj = new DataTable(); if (this.TextBoxXH.Text == "" && this.TextBoxXM.Text == "") { usersj = tjuser.GetUserList(""); } else if (this.TextBoxXH.Text != "" && this.TextBoxXM.Text != "") { string sqltj = " where Sno like '" + this.TextBoxXH.Text + "%' and Name like '" + this.TextBoxXM.Text + "%'"; usersj = tjuser.GetUserList(sqltj); } else if (this.TextBoxXH.Text != "" && this.TextBoxXM.Text == "") { string sqltj = " where Sno like '" + this.TextBoxXH.Text + "%'"; usersj = tjuser.GetUserList(sqltj); } else if (this.TextBoxXH.Text == "" && this.TextBoxXM.Text != "") { string sqltj = " where Name like '" + this.TextBoxXM.Text + "%'"; usersj = tjuser.GetUserList(sqltj); } this.LabelInfo.Text = "共有用户数据" + usersj.Rows.Count + "条"; this.GridView1.DataSource = usersj; GridView1.DataBind(); }
/// <summary> /// 数据绑定 /// </summary> public void DataShow() { Business.Users.User userlist = new Business.Users.User(); DataTable usersj = userlist.GetUserList(""); if (usersj.Rows.Count > 0) { this.LabelInfo.Text = "共有用户数据" + usersj.Rows.Count + "条"; this.GridView1.DataSource = usersj; GridView1.DataBind(); } else { this.LabelInfo.Text = "暂无用户数据!"; } }
/// <summary> /// 数据绑定 /// </summary> public void DataShow() { Business.Users.User userlist = new Business.Users.User(); DataTable usersj = userlist.GetUserList(""); if (usersj.Rows.Count > 0) { this.LabelInfo.Text = "共有用户数据" + usersj.Rows.Count + "条"; this.GridView1.DataSource = usersj; GridView1.DataBind(); } else { this.LabelInfo.Text = "暂无用户数据!"; } }