C#更新Oracle CLOB字段

 

      public static void UpdateClob(string SqlStr, string ValueStr)
        {
            try
            {
                OracleParameter _OracleParameter = new OracleParameter();
                _OracleParameter.ParameterName = "value";
                _OracleParameter.Size = System.Text.Encoding.Default.GetByteCount(ValueStr);
                _OracleParameter.DbType = DbType.String;
                _OracleParameter.OracleType = OracleType.Clob;
                _OracleParameter.Value = ValueStr;

                OpenConnect();
                cmd = new OracleCommand(SqlStr, conn);
                cmd.Parameters.Add(_OracleParameter);
                cmd.ExecuteNonQuery();
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            finally
            {
                cmd.Parameters.Clear();
                CloseConnect();
            }
        }

 

测试调用:

 string Sql = string.Format(@"update pc_rpt_source_trq set pc_rpt_source_trq.rpt_format=:value where pc_rpt_source_trq.rpt_id='{0}'", EditRowNode);
            UpdateClob(Sql, TableFormartString);

 

注意=:value 中的

你可能感兴趣的:(C#更新Oracle CLOB字段)