zoukankan      html  css  js  c++  java
  • 读取文件夹中的文件并修改数据库中的数据

      OraHelper OraHelper = new OraHelper();

            private void btnRead_Click(object sender, EventArgs e)
            {

              

                string[] strFiles = Directory.GetFiles(@"E:\网站\百联项目\goodshtml");
            
                string strProductid = string.Empty;
                string strSql = string.Empty;
                string output = string.Empty;

                foreach(string strFile in strFiles) 
                {
                    strProductid = Path.GetFileName(strFile);

                    strProductid = strProductid.Substring(0, strProductid.IndexOf("."));

                    StreamReader sr = new StreamReader(strFile, System.Text.Encoding.Default);
                    output = sr.ReadToEnd();
                  

                    //output=output.Replace(""
                    strSql = "update web_goods set producthtml= :output where productid='"+strProductid+"'";
                    OracleParameter[] ps=new OracleParameter[1];

                    ps[0] = new OracleParameter();
                    ps[0].ParameterName = ":output";
                    ps[0].OracleType = OracleType.Clob;
                    //ps[0].Size = 2000;
                    ps[0].Value = output;
                
                    OraHelper.ExecuteNonQuery(OraHelper.CONN_STRING,CommandType.Text,strSql,ps);


                     sr.Close();
             
                  

                }

  • 相关阅读:
    hihoCoder #1179 : 永恒游戏 (暴力枚举)
    HDU 5269 ZYB loves Xor I (二分法)
    HDU 5268 ZYB loves Score (简单模拟,水)
    acdream 1683 村民的怪癖(KMP,经典变形)
    acdream 1686 梦醒(时钟重合)
    acdream 1685 多民族王国(DFS,并查集)
    acdream 1681 跳远女王(BFS,暴力)
    HDU 5265 pog loves szh II (技巧)
    HDU 5264 pog loves szh I (字符串,水)
    HDU 1023 Train Problem II (卡特兰数,经典)
  • 原文地址:https://www.cnblogs.com/jameshappy/p/2682954.html
Copyright © 2011-2022 走看看