LifeIsGood

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
CLOB:

 public static string Update_Clob(string strTable, string strFieldName, string strWhere, string strText)
        {
            try
            {
                string strCon = SlnFactoryJ.OracleConnectionPool.GetConnectionString();
                OracleConnection Con = new System.Data.OracleClient.OracleConnection(strCon);
                Con.Open();

                string cmdText = " update " + strTable + " set " + strFieldName + " =   :pb  " + strWhere;
                OracleCommand cmd = new OracleCommand(cmdText, Con);
                OracleParameter op = new OracleParameter("pb", OracleType.Clob);
                op.Value = strText;
                cmd.Parameters.Add(op);
                cmd.ExecuteNonQuery();
                Con.Close();
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
            return "";
        }


BLOB:
   private string SaveByte(string strTableName, string strFiledName, string strWhere, byte[] bytFileUpload, int intFileLength)
        {
            string strCon = SlnFactoryJ.OracleConnectionPool.GetConnectionString();
            string cmdText = "Update " + strTableName + " set " + strFiledName + "=? " + strWhere;
            OleDbConnection connection = new OleDbConnection("Provider=OraOLEDB.Oracle;" +strCon );
            try
            {
                connection.Open();
                OleDbCommand command = new OleDbCommand(cmdText, connection);
                command.Parameters.Add(strFiledName, OleDbType.VarBinary, intFileLength, strFiledName).Value = bytFileUpload;
                command.ExecuteNonQuery();
                connection.Close();
            }
            catch (Exception exception)
            {
                return exception.Message;
            }
            return "";
        }
posted on 2009-08-19 14:32  LifeIsGood  阅读(346)  评论(0编辑  收藏  举报