怎样用asp.net(C#)读取oracle数据库中的图片文件并显示?
byte[] bData = null;
string sContentType = "";
string ID = "";
ID = Request["ID"].ToString();
WdXxDAL wdxx = new WdXxDAL();
DataSet ds = wdxx.GetItemByWDBH(ID);
DataRow dr = ds.Tables[0].Rows[0];
bData = (byte[])dr["WDNR"];
string FileType = dr["wdlx"].ToString().ToLower();
switch (FileType)
{
case "doc":
sContentType = "application/msword";
break;
case "xls":
sContentType = "application/vnd.ms-excel";
break;
case "asf":
sContentType = "video/x-ms-asf";
break;
case "ppt":
sContentType = "application/ppt";
break;
case "avi":
sContentType = "video/avi";
break;
case "zip":
sContentType = "application/zip";
break;
case "gif":
sContentType = "image/gif";
break;
case "bmp":
sContentType = "image/bmp";
break;
case "jpg":
sContentType = "image/jpeg";
break;
case "jpeg":
sContentType = "image/jpeg";
break;
case "wav":
sContentType = "audio/wav";
break;
case "mp3":
sContentType = "audio/mpeg3";
break;
case "mpeg":
sContentType = "video/mpeg";
break;
case "mpg":
sContentType = "video/mpeg";
break;
case "rtf":
sContentType = "application/msword";
break;
case "htm":
sContentType = "text/html";
break;
case "html":
sContentType = "text/html";
break;
//case "txt":
// ContentType = "text/plain";
// break;
//case "dwf":
// ContentType = "application/x-dwf";
// break;
default:
sContentType = "";
break;
}
if (sContentType != "")
{
Response.ContentType = sContentType;
Response.BinaryWrite(bData);
}
为什么图片显示不出来,请大侠指点?
vs2005 oracle 9i 我用的是C# 操作系统xp sp2