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

                }

  • 相关阅读:
    享受法国葡萄酒
    shell (bash) hot keys
    传统MapReduce框架
    【oracle】常用命令
    【转】商业J2EE中间件价值何在?
    【转】Linux(CentOS)服务器上安装Webmin
    【转】CentOS 5安装免费主机控制面板Webmin
    【源码】不规则矩形窗体的设计
    【转】虚拟机VirtualBox+Centos+NAT网络的配置过程
    【jsp】 config配置的关键字
  • 原文地址:https://www.cnblogs.com/jameshappy/p/2682954.html
Copyright © 2011-2022 走看看