Image.aspx 页面
protected void Page_Load(object sender,EventArgs e)
{
if(!IsPostBack)
{
string id=Request.QueryString["Id"].ToString();
SqlConnection con=new SqlConnection("server=PC-PC\\SQL2005;database=UUU1;User Id=sa;Password=sasa");
con.Open();
string strSql="select * from Customer where Id"+id;
SqlCommand com=new SqlCommand(strSql,con);
SqlDataReader dr=com.ExecuteReader();
if(dr.Read())
{
Response.BinaryWrite((byte[])dr["Image"]);
}
con.Close();
}
}
this.Image1.ImageUrl="Image.aspx?Id"+id
其中数据库中Image字段类型为Image,请问高手上边代码有什么问题?
皈依舞
ABOUTYOU