please help i am confused plz plz plz
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class handler : System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
if (Request.QueryString["ImageID"] != null)
{
SqlConnection con = ConnectionManager.GetConnection();
string strQuery = "select Emp_ID,photo,cnic from Employee where Emp_ID=@id";
SqlCommand cmd = new SqlCommand(strQuery);
cmd.Parameters.Add("@id", SqlDbType.NVarChar).Value = Convert.ToInt32(Request.QueryString["ImageID"]);
SqlDataAdapter sda = new SqlDataAdapter();
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
DataTable dt = new DataTable();
try
{
con.Open();
sda.SelectCommand = cmd;
sda.Fill(dt);
}
catch (Exception ex)
{
dt = null;
}
finally
{
con.Close();
sda.Dispose();
con.Dispose();
}
if (dt != null)
{
byte[] bytes ;
if (dt.Rows.Count == 0)
{
bytes = null;
}
else
{
bytes = Convert.ToByte(dt.Rows[1]["photo"]); // Help required please help me
}
Response.Buffer = true;
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "image/jpg";
//Response.AddHeader("content-disposition", "attachment;filename=" & dt.Rows(0)("Name").ToString())
Response.BinaryWrite(bytes);
Response.Flush();
Response.End();
}
}
}
public handler()
{
Load += Page_Load;
}
}