我正在asp.net
使用 oracle 数据库。我想打印保存在旧表中的员工图像。我什至没有保存在该表的照片字段中的图像数据类型。
我使用图像处理程序从新创建的表中打印图像,但是当我在旧表上查询时,图像没有被打印出来。
我怎么知道表格中是否保存了任何图像?
如果有图像为什么它没有被打印?
我将向您展示两个表(新、旧)的图像处理程序代码 新创建的表中的图像打印得非常好,但旧表的问题是什么。
任何人都可以给我任何建议吗?
这是我的ImgHandler.ashx
代码;
public void ProcessRequest (HttpContext context)
{
OracleDataReader rdr = null;
OracleConnection conn = Conn.getConn();
OracleCommand cmd = null;
string ImgType = context.Request.QueryString["typ"].ToString();
try
{
if (ImgType=="edu")//this is working fine
{
cmd = new OracleCommand("select attachment pic from newtbl where lvldcp_code=" + context.Request.QueryString["dcp"] + "and emp_code="+context.Request.QueryString["emp"], conn);
}
else if (ImgType=="profile")
{
cmd = new OracleCommand("select photo pic from oldtbl where emp_code="+context.Request.QueryString["emp"], conn);
}
conn.Open();
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
context.Response.ContentType = "image/jpg";
context.Response.BinaryWrite((byte[])rdr["pic"]);
}
if (rdr != null)
rdr.Close();
}
catch (Exception ex)
{
}
finally
{
if (conn != null)
conn.Close();
}
}