调试通过,其他的显示都正常,就是没法显示图片,表格里的图片全部打红叉叉,为什么,大家应该都做过,给点提示好吗
解决方案 »
- 求助,谁能解释一下这玩意儿是怎么来的
- 关于js打印(window.print();) 去除页眉页脚的问题
- B/S 一些CheckBox控件 Button提交时判断CheckBox选中状态checked属性
- div中嵌套多个div怎么设置子div离父div的高度
- Linq 分页查询的问题+++++在线等
- 数据查询问题(最近有点晕)
- 静态页面怎么调动ajax.net的后台代码(刚学)?
- 要Atlas+sql2000+asp.net 2.0的流言本/计数器/站内短信 ajax的也行
- 请问这句啥意思? lock(typeof(SQLAccessFactory)){...}
- 项目外包招标(限深圳)
- 在脚本window的onunload事件中如何分辩是关闭窗口还是导航到其他页面还是...
- 关于数据库的问题
路径没有问题,我把我代码关键部分贴上来,大家帮我看看呀
showphoto.aspx
protected void BindGrid()
{
SqlConnection CN = new SqlConnection() ;
CN.ConnectionString= "data source=localhost;initial catalog=bbs;persist security info=False;user id=sa;Password=sa;
string sqlstr="select img_pk, img_data from image";
SqlCommand cm=new SqlCommand(sqlstr,CN);
CN.Open();
dg2.DataSource=cm.ExecuteReader();
dg2.DataBind();
CN.Close();}
protected string FormatURL(object strArgument)
{
return "ReadImage.aspx?id=" + strArgument.ToString();
}ReadImage.aspx
private void Page_Load(object sender, System.EventArgs e)
{
string strImageID = Request.QueryString["id"];
SqlConnection CN = new SqlConnection() ;
CN.ConnectionString= "data source=localhost;initial catalog=bbs;persist security info=False;user id=sa;Password=sa;";
SqlCommand cm = new SqlCommand("Select image_data,img_contenttype from image Where img_pk='"+strImageID+"'",CN);
CN.Open();
SqlDataReader dr=cm.ExecuteReader();
if(dr.Read())
{
Response.Clear(); Response.ContentType = dr["img_contenttype"].ToString();
Response.BinaryWrite((byte[])dr["img_data"]);
}
cm.Connection.Close();
Response.OutputStream.Write((byte[])dr["img_data"], 0, (int)dr["imagesize"]);
//dr["imagesize"]是图片的大小