修改

connection.Open();

  
 string queryString = "UPDATE nation set capital = 'X' where `code` = 'A'";
  
 CUBRIDCommand command = new CUBRIDCommand(queryString, connection);
 Int32 recordsAffected = command.ExecuteNonQuery();
删除
// Assumes connection is a valid SqlConnection.

connection.Open();
 
string queryString = "DELETE FROM nation where `code` = 'A'";
 
CUBRIDCommand command = new CUBRIDCommand(queryString, connection);
Int32 recordsAffected = command.ExecuteNonQuery();
 
 
写入blob类型数据
using CUBRID.Data.CUBRIDClient;

     
  namespace BLOBExample
  {
      class Program
      {
          static void Main(string[] args)
          {
              CUBRIDConnectionStringBuilder sb = new CUBRIDConnectionStringBuilder("localhost""demodb""public""""33000"true);
              using (CUBRIDConnection conn = new CUBRIDConnection(sb.GetConnectionString()))
              {
                  conn.Open();
     
                  string sql = "insert into Employees (Photo) values(?)";
                  using (CUBRIDCommand cmd = new CUBRIDCommand(sql, conn))
                  {
                      CUBRIDBlob Blob = new CUBRIDBlob(conn);
                      byte[] bytes;
                      BinaryReader _reader = new BinaryReader(File.Open(@".\John.jpg", FileMode.Open));
                      int length = (int)_reader.BaseStream.Length;
                      bytes = _reader.ReadBytes(length);
   
                      Blob.setBytes(1, bytes);
                      CUBRIDParameter param = new CUBRIDParameter();
                      param.ParameterName = "?";
                      param.CUBRIDDataType = CUBRIDDataType.CCI_U_TYPE_BLOB;
                      param.DbType = DbType.Binary;
                      param.Value = Blob;
 
                      cmd.Parameters.Add(param);
                      cmd.ExecuteNonQuery();
                  }
   
                  conn.Close();
              }
          }
      }
  }
 
 
写入clob数据
using CUBRID.Data.CUBRIDClient;

     
 namespace BLOBExample
 {
     class Program
     {
         static void Main(string[] args)
         {
             CUBRIDConnectionStringBuilder sb = new CUBRIDConnectionStringBuilder("localhost", "demodb", "public", "", "33000", true);
             using (CUBRIDConnection conn = new CUBRIDConnection(sb.GetConnectionString()))
             {
                 conn.Open();
     
                 string sql = "insert into Employees(resume) values(?)";
                 using (CUBRIDCommand cmd = new CUBRIDCommand(sql, conn))
                 {
                     StreamReader _reader = new StreamReader(File.Open(@".\John.txt", FileMode.Open));
                     string _resume = _reader.ReadToEnd();
                     _reader.Close();
 
                     CUBRIDBlob Blob = new CUBRIDBlob(conn);
                     Clob.setString(1, _resume);
 
                     CUBRIDParameter param = new CUBRIDParameter();
                     param.ParameterName = "?";
                     param.CUBRIDDataType = CUBRIDDataType.CCI_U_TYPE_CLOB;
                     param.Value = Blob;
                     cmd.Parameters.Add(param);
                     cmd.ExecuteNonQuery();
                     cmd.Close();
                 }
   
                 conn.Close();
             }
         }
     }
 }
 
 
 
 
 
 
 
 
 

CUBRID学习笔记 40 使用net修改数据的更多相关文章

  1. tensorflow学习笔记——使用TensorFlow操作MNIST数据(1)

    续集请点击我:tensorflow学习笔记——使用TensorFlow操作MNIST数据(2) 本节开始学习使用tensorflow教程,当然从最简单的MNIST开始.这怎么说呢,就好比编程入门有He ...

  2. tensorflow学习笔记——使用TensorFlow操作MNIST数据(2)

    tensorflow学习笔记——使用TensorFlow操作MNIST数据(1) 一:神经网络知识点整理 1.1,多层:使用多层权重,例如多层全连接方式 以下定义了三个隐藏层的全连接方式的神经网络样例 ...

  3. 【转】Pandas学习笔记(三)修改&添加值

    Pandas学习笔记系列: Pandas学习笔记(一)基本介绍 Pandas学习笔记(二)选择数据 Pandas学习笔记(三)修改&添加值 Pandas学习笔记(四)处理丢失值 Pandas学 ...

  4. 【转】Pandas学习笔记(二)选择数据

    Pandas学习笔记系列: Pandas学习笔记(一)基本介绍 Pandas学习笔记(二)选择数据 Pandas学习笔记(三)修改&添加值 Pandas学习笔记(四)处理丢失值 Pandas学 ...

  5. SQL反模式学习笔记18 减少SQL查询数据,避免使用一条SQL语句解决复杂问题

    目标:减少SQL查询数据,避免使用一条SQL语句解决复杂问题 反模式:视图使用一步操作,单个SQL语句解决复杂问题 使用一个查询来获得所有结果的最常见后果就是产生了一个笛卡尔积.导致查询性能降低. 如 ...

  6. 机器学习实战(Machine Learning in Action)学习笔记————09.利用PCA简化数据

    机器学习实战(Machine Learning in Action)学习笔记————09.利用PCA简化数据 关键字:PCA.主成分分析.降维作者:米仓山下时间:2018-11-15机器学习实战(Ma ...

  7. Dynamic CRM 2015学习笔记(4)修改开发人员资源(发现服务、组织服务和组织数据服务)url地址及组织名

    在azure vm上安装了CRM 2015后 Dynamic CRM 2015学习笔记(1)Azure 上安装 CRM 2015, 发现了一个问题,那就是在设置 ->自定义项 –> 开发人 ...

  8. Mysql学习笔记(三)对表数据的增删改查。

    正文内容. 这一部分是最简单的,也是最麻烦的.简单是因为其实只包括增删该插四个部分.大体上看,增加数据.删除数据.修改数据.查询数据都不麻烦啊,我们日常都是常用的.这个谁不会呢?以前在培训机构学mys ...

  9. CUBRID学习笔记 48查询优化

    cubrid的中sql查询语法 查询优化 c#,net,cubrid,教程,学习,笔记欢迎转载 ,转载时请保留作者信息.本文版权归本人所有,如有任何问题,请与我联系wang2650@sohu.com ...

随机推荐

  1. spring Aop的一个demo

    面向切面是什么我就不说了. 上代码: package com.foreveross.service.weixin.test; import java.lang.annotation.Documente ...

  2. git log用法【转】

    转自:http://www.cnblogs.com/gbyukg/archive/2011/12/12/2285419.html PHP技术交流群 170855791 git log 查看提交记录,参 ...

  3. python 补充-decode和encode

    1. decode与encode转码 在Python3中默认编码就是uncode,encode转成Byte类型 在Python2中默认编码就是ascii window下默认编码是GBK decode( ...

  4. php时间函数整理

    PHP中的时间函数有这么些:(1)date用法: date(格式,[时间]);如果没有时间参数,则使用当前时间. 格式是一个字符串,其中以下字符有特殊意义:U 替换成从一个起始时间(好象是1970年1 ...

  5. poj1987 Distance Statistics

    普通dfs访问每个点对的复杂度是O(n^2)的,显然会超时. 考虑访问到当前子树的根节点时,统计所有经过根的点(u, v)满足: dist(u) + dist(v) <= maxd,并且 bel ...

  6. Linux 多线程应用中如何编写安全的信号处理函数

    http://blog.163.com/he_junwei/blog/static/1979376462014021105242552/ http://www.ibm.com/developerwor ...

  7. 2016年省赛G题, Parenthesis

    Problem G: Parenthesis Time Limit: 5 Sec  Memory Limit: 128 MBSubmit: 398  Solved: 75[Submit][Status ...

  8. Can't create handler inside thread that has not called Looper.prepare()

    参考文章:http://stackoverflow.com/questions/7185942/error-while-dispaying-an-toast-message-cant-create-h ...

  9. 收集的55个Linux系统管理中常用的一些shell命令

    .显示消耗内存/CPU最多的10个进程 代码如下: | tail | tail .查看进程 按内存从大到小排列 代码如下: ps -e -o "%C : %p : %z : %a" ...

  10. 使用StarUML创建类图

    使用StarUML创建类图 http://www.flyne.org/article/379 1.综述(What) StarUML是一种生成类图和其他类型的UML图表的工具.本文是一个使用StarUM ...