zoukankan      html  css  js  c++  java
  • 检测场所条件查询

    #region 检测场所条件查询
    private void btnClick_JCCS_TiaoJianChaXun(object sender, RoutedEventArgs e)
    {
    string JianCeChangSuoMingCheng = textbox1.Text;
    //BASESPACE bsXmlb = cbo_changsuoleibie.SelectedItem as BASESPACE;
    //string combo = cbo_changsuoleibie.SelectedItem.ToString();
    Sys_dictionary sys = cbo_changsuoleibie.SelectedItem as Sys_dictionary;
    //MessageBox.Show(sys.Id+"");
    int ID = sys.Id;
    MessageBox.Show(ID+"");
    //string SqlQueryByNameAndId = "select b.id as ID, b.name as NAME, s.name as XMLB from BASESPACE b ,SYS_DICTIONARY s where b.xmlb = s.id and s.id = " + ID + " and b.name like '%" + name + "%'";
    StringBuilder strBuilder = new StringBuilder("select b.id as ID, b.name as NAME, s.name as XMLB from BASESPACE b ,SYS_DICTIONARY s where b.xmlb = s.id ");

    if (JianCeChangSuoMingCheng != null && !"".Equals(JianCeChangSuoMingCheng)) {
    //strBuilder.Append(" and b.name like '%" + JianCeChangSuoMingCheng + "%' ");
    strBuilder.Append(" and b.name like '%").Append(JianCeChangSuoMingCheng).Append("%' ");
    }


    if (ID != 1)
    {
    //MessageBox.Show("名称1:" + JianCeChangSuoMingCheng + "- -" + "下拉框ID: " + sys.Id + "下拉框Name: " + sys.Name);
    if (JianCeChangSuoMingCheng != null && !"".Equals(JianCeChangSuoMingCheng))
    {
    //strBuilder.Append(" and b.name like '%" + JianCeChangSuoMingCheng + "%' ");
    strBuilder.Append(" and s.id = ").Append(ID);
    }
    else {
    strBuilder.Append(" and s.id = ").Append(ID);
    }
    }


    //else
    //{
    // //MessageBox.Show("名称2:" + JianCeChangSuoMingCheng + "- -" + "下拉框ID: " + sys.Id + "下拉框Name: " + sys.Name);
    // //strBuilder.Append(" and s.id = ").Append(ID).Append(" ");
    //}
    //wcf.GetQueryByNameAndIdCompleted += new EventHandler<GetQueryByNameAndIdCompletedEventArgs>(wcf_GetQueryByNameAndIdCompleted);
    //wcf.GetQueryByNameAndIdAsync(JianCeChangSuoMingCheng, ID);

    wcf.GetQueryByNameAndIdStrCompleted += new EventHandler<GetQueryByNameAndIdStrCompletedEventArgs>(wcf_GetQueryByNameAndIdStrCompleted);
    wcf.GetQueryByNameAndIdStrAsync(strBuilder.ToString());
    }

    void wcf_GetQueryByNameAndIdStrCompleted(object sender, GetQueryByNameAndIdStrCompletedEventArgs e)
    {
    //throw new NotImplementedException();
    dg_student.ItemsSource = e.Result;
    }

    //void wcf_GetQueryByNameAndIdCompleted(object sender, GetQueryByNameAndIdCompletedEventArgs e)
    //{
    // //throw new NotImplementedException();
    // dg_student.ItemsSource = e.Result;
    //}
    #endregion

    牧 19:36:05
    e.Result.Where(t => t.Id ==“1”) 这个表示获取全部等于1的数据

  • 相关阅读:
    做程序员,我骄傲了吗?
    乐字节Java面向对象三大特性以及Java多态
    Java为什么有前途?什么人适合学Java?
    Java新手从入门到精通的学习建议
    Java变量与数据类型之二:Java常量与变量
    模块化、结构化的代码,程序员正讲述着人生
    乐字节Java变量与数据类型之一:Java编程规范,关键字与标识符
    乐字节Java学习课程-path环境变量的作用与配置
    我英语不好,能学会编程吗?
    为什么欧拉图要用栈存然后逆着输出
  • 原文地址:https://www.cnblogs.com/meimao5211/p/3457745.html
Copyright © 2011-2022 走看看