把ORACLE数据库中的bblob字段导成图片(C#实现)
2009-04-07 23:22
423 查看
string myOraclestr = "Data Source=" + this.textBox1.Text + ";User Id=" + this.textBox2.Text + ";Password=" + this.textBox3.Text + ";";
OracleConnection conn = new OracleConnection(myOraclestr);
OracleCommand cmd = conn.CreateCommand();
conn.Open();
cmd.CommandText = "select r.sfzhm,p.txsj from hdds_obj_0000r010000 r,hdds_obj_0000picture p where r.zxbs is null and r.photoid is not null and r.photoid=p.serial_no";
OracleDataReader dr = cmd.ExecuteReader();
int i=0;
while (dr.Read())
{
try
{
byte[] tempByte = (byte[])dr[1];
FileStream fs = new FileStream(this.textBox4.Text + "\\" + dr[0].ToString() + ".jpg", FileMode.Create);
fs.Write(tempByte, 0, tempByte.Length);
fs.Close();
Application.DoEvents();
this.label5.Text = (i++).ToString();;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
dr.Close();
conn.Close();
MessageBox.Show("导出完成!!!");
OracleConnection conn = new OracleConnection(myOraclestr);
OracleCommand cmd = conn.CreateCommand();
conn.Open();
cmd.CommandText = "select r.sfzhm,p.txsj from hdds_obj_0000r010000 r,hdds_obj_0000picture p where r.zxbs is null and r.photoid is not null and r.photoid=p.serial_no";
OracleDataReader dr = cmd.ExecuteReader();
int i=0;
while (dr.Read())
{
try
{
byte[] tempByte = (byte[])dr[1];
FileStream fs = new FileStream(this.textBox4.Text + "\\" + dr[0].ToString() + ".jpg", FileMode.Create);
fs.Write(tempByte, 0, tempByte.Length);
fs.Close();
Application.DoEvents();
this.label5.Text = (i++).ToString();;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
dr.Close();
conn.Close();
MessageBox.Show("导出完成!!!");
相关文章推荐
- c# winform 操作oracle数据库的Blob字段,把图片存储到数据库,保存图片到数据库
- C#实现多级子目录Zip压缩解压实例 NET4.6下的UTC时间转换 [译]ASP.NET Core Web API 中使用Oracle数据库和Dapper看这篇就够了 asp.Net Core免费开源分布式异常日志收集框架Exceptionless安装配置以及简单使用图文教程 asp.net core异步进行新增操作并且需要判断某些字段是否重复的三种解决方案 .NET Core开发日志
- 操作Oracle数据库实现上传图片到Blob类型的字段
- 操作Oracle数据库实现上传图片到Blob类型的字段出现的问题
- 操作Oracle数据库实现上传图片到Blob类型的字段出现的问题
- 操作Oracle数据库实现上传图片到Blob类型的字段出现的问题
- C#编程实现简易图片浏览器的方法
- c#实现图片裁剪
- C#编写的类库,实现将pdf转换成图片(jpg)
- C#如何实现图片查看器
- C# 实现的图片盖章功能,支持拖拽、旋转、放缩、保存
- C#实现拆分、合并GIF图片
- c# 实现对图片上传的接收
- [Windows Mobile] C#实现GIF图片播放
- C#中如何实现数据拖动?(拖动图片,到TextBox,并显示)
- 用C#实现图片文件与base64string编码解码
- 鼠标滚动实现图片的放大和缩小(C#2.0)
- C#实现winform下图片的上传预览保存以及在桌面应用系统的应用
- c#实现图片gif去水印
- ASP.NET(C#) 实现将图片以二进制保存到数据库中 转