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();
             
                  

                }

  • 相关阅读:
    快速提取某一文件夹下所有文件名称
    CFileFind类的使用总结
    FILE文件流的中fopen、fread、fseek、fclose的使用
    经典损失函数:交叉熵(附tensorflow)
    tensorboard使用
    Windows下 tensorboard出现ValueError:Invalid format string
    新建全色或者resize(毫无价值,只是做记录)
    创建一个任意大小的全色矩阵 python
    转移图片位置
    getpatch
  • 原文地址:https://www.cnblogs.com/jameshappy/p/2682954.html
Copyright © 2011-2022 走看看