• c# List<string>的用法


    cs代码:

    public List<string> Get_emp_no()
        {
            List<string> emp_no_str = new List<string>();
            string str = "select * from staff_dict where emp_no='" + Session["Emp_No"].ToString() + "' or EMPLOYEE_ID='" + Session["Emp_No"].ToString() + "'";
            OracleDataAdapter da = new OracleDataAdapter(str, StrConn_Oracle);
            DataSet ds = new DataSet();
            da.Fill(ds);
            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    emp_no_str.Add(ds.Tables[0].Rows[i]["emp_no"].ToString());
                }
                
            }
            return emp_no_str;
        }
        /// <summary>
        /// 初始数据
        /// </summary>
        public void Init_Data()
        {
            string ret_code = "";
            string str_ora = "select * from staff_dict where name ='" + Session["UserName"].ToString() + "'";
            DataSet ds_ora = DbHelperOralce.Query(str_ora);
            // 判断是否 有工号 
            if (ds_ora.Tables[0].Rows.Count > 0)
            {
                string strsql = "";
                // 判断是否是 护士长
                string strqry = "";
                if (Get_emp_no().Count > 0)
                {
                    for (int i = 0; i < Get_emp_no().Count; i++)
                    {
                        strqry += "leader_emp_no like '%" + Get_emp_no()[i] + "%'"+" or ";
                    }
                    int l = strqry.Length;
                    strqry = strqry.Substring(0, l - 3);
                }
                string str = " select * from Clinical_Dict  where 1=1 and "+strqry+"";
                DataSet ds = DbHelperSQL.Query(str);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    int i = ds.Tables[0].Rows.Count;
                    for (int j = 0; j < i; j++)
                    {
                        ret_code += "'"+ds.Tables[0].Rows[j]["ID"].ToString()+"'" + ",";
                    }
                    int l = ret_code.Length;
                    ret_code = ret_code.Substring(0, l - 1);
                    strsql += "   a.dept_code  in (" + ret_code +")";            
                
                    string SqlString = "select distinct a.Title_ID, b.title,a.Dept_Code,a.Dept_Name,a.Ygbh,a.YGXM,a.Test_Type,a.test_date,a.Tester,a.Fee_Read_Flag,a.kaohe_times+1 as kaohe_times ,a.kaohe_times as times,a.Feedback,a.apply_range from KaoHe_FeeBack_Detail a left join subject_title b on a.title_id=b.id  where ("+ strsql+") and a.fee_read_flag='0'  and a.submit_flag='1'  and a.Apply_Range=b.Apply_Range order by a.apply_range,a.kaohe_times desc,a.Test_date desc ";
                   DataSet ds_sql = DbHelperSQL.Query(SqlString);
                   SearchGrird.DataSource = ds_sql.Tables[0];//绑定数据源
                   SearchGrird.DataBind();
                   Panel1.Visible = true;
                }
               
            }
        }
  • 相关阅读:
    从验证谈起
    今天感触
    弱点
    经济平衡一些看法
    关于灵魂
    关于博弈论中的一硬币正反问题的分析<二>
    java8新特性:对map集合排序
    junit单元测试不通过报documentationPluginsBootstrapper相关异常
    Maven打包报错:[WARNING] The POM for xxx is missing, no dependency inform
    理解maven命令package、install、deploy的联系与区别
  • 原文地址:https://www.cnblogs.com/chenpanpan/p/14475747.html
Copyright © 2020-2023  润新知