<%@ WebHandler Language="C#" Class="ImageHandler" %> using System; using System.Web; using System.Configuration; using MySql.Data.MySqlClient; public class ImageHandler : IHttpHandler { string strcon = ConfigurationManager.ConnectionStrings["WelfareDB"].ToString(); public void ProcessRequest (HttpContext context) { if (context.Request.QueryString["ImID"] !=null) { string imgid = context.Request.QueryString["ImID"]; MySqlConnection con = new MySqlConnection(strcon); con.Open(); string qry = "select image from inchargedetail where inchargeid=@detailid"; MySqlParameter detailidP = new MySqlParameter("@detailid", imgid); MySqlDataReader dr = MySqlHelper.ExecuteReader(con, qry, detailidP); dr.Read(); context.Response.BinaryWrite((Byte[])dr[0]); con.Close(); context.Response.End(); } } public bool IsReusable { get { return false; } } }
DBNull.Value.Equals(someValue);
someValue != null
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)