SqlConnection conn=new SqlConnection(strConn);
string strSql="SELECT 会员照片,照片类型 FROM member WHERE MemberID="+MemberID.ToString();
SqlCommand comm=new SqlCommand(strSql,conn);
conn.Open();
SqlDataReader dr=comm.ExecuteReader();
if(dr.Read())
{
byte[] Buffer = (byte[])dr[0];
//int count=dr["会员照片"].ToString().Length; //输出
this.Response.Clear();
//输出mime类型,根据上传的文件取到的mimetype,是什么我忘记了,自己写上,不过不写也没有关系.
this.Response.ContentType = dr[1].ToString();
this.Response.OutputStream.Write(Buffer,0,Buffer.Length);
this.Response.End();
} dr.Close();
conn.Close();这个代码提示byte[] Buffer = (byte[])dr[0];指定的类型转换无效没分了,谢谢帮忙看下