• 读取文件夹中的文件并修改数据库中的数据


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

                }

  • 相关阅读:
    Android 6.0 运行时权限处理完全解析
    Android 6.0 运行时权限处理
    史上比较用心的纯代码实现 AutoLayout
    hdu 4268 Alice and Bob(multiset|段树)
    在单调的队列
    Python re正则表达式
    minihomepage.exe 百度视频迷你主页
    POJ 2914 Minimum Cut 最小割图论
    移植kl档,但调用默认Generic.kl解决的方法
    iOS 删除黑色边框线导航栏&删除搜索框的阴影边界线和中黑色文本输入框 - 解
  • 原文地址:https://www.cnblogs.com/jameshappy/p/2682954.html
Copyright © 2020-2023  润新知