使用数据源为System.Data.Oledb,Provider为Oracle Provider For .Net
没用OracleClient,因为这个只能用在Oracle
Provider要改为Oracle Proider form Net,默认的MS Oledb For Oracle不支持高版本Oracle(8.0以上)
ConnectionString如下:
Provider=OraOLEDB.Oracle.1;Password=“”;Persist Security Info=True;User ID=“”;Data Source=“”

获取Lob数据
DataAdpter.Fill(DataSet);
通过DataType判断为Lob后
强制转化该列为byte[]

C#中通过OleDb操作Oracle Blob数据类型if ( ds.Tables["tAttrFile"].Columns[sFieldName].DataType == typeof(System.Byte[]))
                                                


插入、修改Lob数据
使用Command的Parameters,类型为Binary

C#中通过OleDb操作Oracle Blob数据类型byte[] data = cs.Base64DecodeEx(sData);
C#中通过OleDb操作Oracle Blob数据类型
C#中通过OleDb操作Oracle Blob数据类型                cmd[
0= new System.Data.OleDb.OleDbCommand();
C#中通过OleDb操作Oracle Blob数据类型                cmd[
0].CommandText = "delete from " + sTableName + " where sProjID='" + sProjID +
C#中通过OleDb操作Oracle Blob数据类型                    
"' and iDegree=" + iDegree.ToString();
C#中通过OleDb操作Oracle Blob数据类型            
C#中通过OleDb操作Oracle Blob数据类型                cmd[
1= new System.Data.OleDb.OleDbCommand();
C#中通过OleDb操作Oracle Blob数据类型                cmd[
1].CommandText = "insert into " + sTableName+" (sProjID,iDegree,"  + sFieldName + ") values ('" + 
C#中通过OleDb操作Oracle Blob数据类型                    sProjID 
+ "',"+ iDegree.ToString() + ",:bData)";
C#中通过OleDb操作Oracle Blob数据类型                cmd[
1].Parameters.Add("bData",System.Data.OleDb.OleDbType.Binary,data.Length);
C#中通过OleDb操作Oracle Blob数据类型                cmd[
1].Parameters["bData"].Value = data;
C#中通过OleDb操作Oracle Blob数据类型                iResult 
= db.ExecuteSqls(cmd,2);    




 

相关文章:

  • 2022-01-24
  • 2021-10-25
  • 2021-12-07
  • 2022-12-23
  • 2021-06-03
  • 2021-08-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-19
  • 2021-12-10
  • 2021-07-15
  • 2021-11-27
  • 2021-12-06
相关资源
相似解决方案