zoukankan      html  css  js  c++  java
  • txt内容导入数据库

    public bool ImportPurviewManIds(string fileName, string CurrentUserDomainId, string Pduid, string uploadtype) 
            { 
                try 
                { 
                    if (File.Exists(fileName)) 
                    { 
                        //读取文件 一行一行读取 
                        StreamReader objReader = new StreamReader(fileName, Encoding.Default); 
                        string sLine = ""; 
                        List<string> arrText = new List<string>(); 

                        while (sLine != null) 
                        { 
                            sLine = objReader.ReadLine(); 
                            if (!string.IsNullOrEmpty(sLine)) 
                            { 
                                arrText.Add(sLine); 
                            } 
                        } 
                        objReader.Close(); 


                        List<iPAL.Models.Pub.INFO_USER_CONFIG> objlist = new List<INFO_USER_CONFIG>(); 
                        IUserVisit uv = new UserVisit(); 
                        foreach (string strline in arrText.Distinct()) 
                        { 
                            if (string.IsNullOrEmpty(strline.Trim())) 
                                continue; 
                            UserInfo info = uv.GetHRInfo(strline.ToLower().Trim()); 
                            INFO_USER_CONFIG obj = new INFO_USER_CONFIG(); 
                            obj.SvrId = int.Parse(Pduid); 
                            obj.RoleName = "普通用户"; 
                            obj.UserId = strline.ToLower().Trim(); 
                            obj.UserCnName = info.UserName; 
                            objlist.Add(obj); 

                        } 
                        db.INFO_USER_CONFIG.InsertAllOnSubmit(objlist); 
                        db.SubmitChanges(); 
                    } 
                    return true; 
                } 
                catch (Exception ex) 
                { 
                    throw ex; 
                    return false; 
                } 
            }

  • 相关阅读:
    P1311 选择客栈 模拟 ( + st表)
    P2656 采蘑菇 tarjan + spfa
    送别
    10.16互测题 贪心+数论
    poj 2823 Sliding Window 单调队列
    P1036 选数 dfs
    P3370 【模板】字符串哈希
    A Tear or A Smile?
    KMP 算法
    jQuery 中 attr 和 prop 的区别
  • 原文地址:https://www.cnblogs.com/cw_volcano/p/2173526.html
Copyright © 2011-2022 走看看