如何用js显示从数据库中读出来的二进制流图片
后台代码:
[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)
{
如何显示这个二进制流图片
}
}