http://expert.csdn.net/Expert/topic/1424/1424660.xml?temp=.794079
解决方案 »
- 二进制流把图片存进oracle数据库,blob类型.提示“ORA-01459: 变量字符串长度无效“
- C# 过滤Datatable中相同的行
- 如果想让BLL层控制UI层label的text属性 有办法嘛。
- 多线程的问题,为什么是这样
- 如何在窗体的load事件里,调用keydown事件,判断是否按下了Shift键?
- C#数据库连接写入注册表问题(VS2005 WinForm)
- 水晶报表子报表如何绑定数据源
- 请问Visual Studio Tools for the Microsoft Office System
- windows service 内存上涨问题
- 怎样获取图像采集卡的句柄
- 过一个没有情人的情人节!!放分!!!!!!!!!
- 谁能给个用 c# 写 mmc 控制台的实例?
Now, let us read the images from the database we stored previously. Here, we will output the image directly to the browser. You can instead save it as a file or do whatever you want.
private void Page_Load(object sender, System.EventArgs e)
{
string imgid =Request.QueryString["imgid"];
string connstr=((NameValueCollection)
Context.GetConfig("appSettings"))["connstr"];
string sql="SELECT imgdata, imgtype FROM ImageStore WHERE id = "
+ imgid;
SqlConnection connection = new SqlConnection(connstr);
SqlCommand command = new SqlCommand(sql, connection);
connection.Open();
SqlDataReader dr = command.ExecuteReader();
if(dr.Read())
{
Response.ContentType = dr["imgtype"].ToString();
Response.BinaryWrite( (byte[]) dr["imgdata"] );
}
connection.Close();
}