Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
Pls Help me.Thanks in advance
 

<%@ 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;
        }
    }
 
}
Posted 30-Nov-12 18:57pm
Comments
pankajgarg1986 at 1-Dec-12 0:58am
   
how to check for system.dbnull in if statement

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Please see: http://msdn.microsoft.com/en-us/library/system.dbnull.aspx[^],
http://msdn.microsoft.com/en-us/library/system.dbnull.value.aspx[^].
 
For example: DBNull.Value.Equals(someValue); but in general case, first make sure someValue != null.
 
—SA
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 432
1 Kornfeld Eliyahu Peter 420
2 Yogesh Kumar Tyagi 244
3 Nelek 115
4 Gihan Liyanage 99
0 Kornfeld Eliyahu Peter 420
1 OriginalGriff 303
2 Yogesh Kumar Tyagi 230
3 Gihan Liyanage 99
4 sankarsan parida 90


Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 1 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100