求助:关于使用C#实现word文档存入Oracle数据库
本人刚开始研究Oracle数据库,现想实现使用c#把Word文档以二进制数据流存入Oracle数据库,现Oracle建立了测试表test,表项为ID、DOCU,求助有没有可用源码?
------解决思路----------------------
oracle中操作blob
1、insert 数据,blob用empty_blob()填充;
2、更新blob列数据
#region 更新一条包含一个Clob列的记录 DBUpdateClob
///
/// 更新一条包含一个Clob列的记录
///
/// 表名
/// where条件,不包含“where”
/// Clob列名
/// Clob列值
/// 返回值,1成功,0失败
public int DBUpdateClob(string TableName, string WhereClause, string ClobColName, string ClobColValue)
{
int temp = 0;
try
{
this.DBConnection();
this.trans = this.conn.BeginTransaction();
this.cmd.Transaction = this.trans;
this.cmd.CommandText = "select " + ClobColName + " from " + TableName + " where " + WhereClause + " for update";
this.dr = this.cmd.ExecuteReader();
dr.Read();
OracleClob srcClob = dr.GetOracleClob(0);
byte[] buffer = System.Text.Encoding.Unicode.GetBytes(ClobColValue);
srcClob.Erase();
srcClob.Write(buffer, 0, buffer.GetLength(0));
this.trans.Commit();
temp = 1;
}
catch
{
this.trans.Rollback();
}
finally
{
this.DBDisconnection();
}
return temp;
}
#endregion