[Ajax.AjaxMethod]
public byte[] ReturnStudentPicture(string studentid)
{
CUntily Untily = new CUntily();
Untily.DBOpen();
string cmdText = "select picture from student where studentid=" + studentid;
OleDbCommand com = new OleDbCommand(cmdText, Untily.DBConnection);
OleDbDataReader reader = com.ExecuteReader();
byte[] ss = null;
if (reader.Read())
{
ss = (byte[])reader["picture"];
}
reader.Close();
Untily.DBClose();
return ss;
}
前台代码:
function View_Student_Picture(_studentid)
{
StudentArchive_View_Student.ReturnStudentPicture(_studentid,callViewStudentPicture);
}
function callViewStudentPicture(response)
{
if(response.value!=null)
{
如何显示这个二进制流图片
}
}
5 个解决方案
#1
怎么没人啊?
#2
直接输出文件
Response.ContentType = "application/octet-stream";
Response.BinaryWrite((Byte[])reader["picture"]);
Response.ContentType = "application/octet-stream";
Response.BinaryWrite((Byte[])reader["picture"]);
#3
页面上放个img,设置src为某个页面的输出流,格式如上...
看看CSDN上面那个输入验证码的img就明白了。
看看CSDN上面那个输入验证码的img就明白了。
#4
谢谢wuyq11和cuike519,我实现了。
#5
http://topic.csdn.net/u/20111114/14/40524138-0ca0-4410-8da8-de006926f309.html?seed=195091384&r=76483056#r_76483056
楼主能请教一下你怎么实现的吗?能把代码给小弟看看吗
#1
怎么没人啊?
#2
直接输出文件
Response.ContentType = "application/octet-stream";
Response.BinaryWrite((Byte[])reader["picture"]);
Response.ContentType = "application/octet-stream";
Response.BinaryWrite((Byte[])reader["picture"]);
#3
页面上放个img,设置src为某个页面的输出流,格式如上...
看看CSDN上面那个输入验证码的img就明白了。
看看CSDN上面那个输入验证码的img就明白了。
#4
谢谢wuyq11和cuike519,我实现了。
#5
http://topic.csdn.net/u/20111114/14/40524138-0ca0-4410-8da8-de006926f309.html?seed=195091384&r=76483056#r_76483056
楼主能请教一下你怎么实现的吗?能把代码给小弟看看吗