public List get_ballot() { csDAL objdal = new csDAL(); List objlist = new List(); IDataReader dr = null; dr = objdal.executespreturndr("get_ballot"); while (dr.Read()) { Ballot objc = new Ballot(); populate_reader(dr, objc); objlist.Add(objc); } return objlist; } private void populate_reader(IDataReader objdr, Ballot objc) { objc.id = objdr.GetInt32(0); objc.imgName = objdr.GetString(1); objc.pic1 = (Byte[])objdr.GetValue(2); objc.pic2 = (Byte[])objdr.GetValue(3); } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using BLL; namespace SEARCH { /// /// Summary description for Grabimg /// public class Grabimg : IHttpHandler { public void ProcessRequest(HttpContext context) { Int32 id; if (context.Request.QueryString["id"] != null) {id=Convert.ToInt32 (context .Request .QueryString ["id"]);} else {throw new ArgumentException("No parameter specified");} context .Response .ContentType ="img/jpeg"; System.IO.Stream strm = showImg(id); Byte[] buffer = new Byte[strm.Length]; int bytesql = strm.Read(buffer, 0, buffer.Length); while (bytesql > 0) { context.Response.OutputStream.Write(buffer, 0, bytesql); bytesql = strm.Read(buffer, 0, buffer.Length); strm.Close(); } //public System .IO .Stream ShowImg(Int32 id) //{ //BLL.Ballot objc=new BLL.Ballot (); // objc.id=id; // objc.imgName = //} //context.Response.ContentType = "text/plain"; //context.Response.Write("Hello World"); } public System .IO .Stream ShowImg(int id) { BLL.Ballot objc=new BLL.Ballot (); List obji = new List(); obji.id=id; obji = obji.get_ballot(); } private System.IO.Stream showImg(int id) { throw new NotImplementedException(); } public bool IsReusable { get { return false; } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)