خرید بک لینک

Vote count: 0

I have database with EmpNo(Int) and EmpImage(Image) columns.

I am using HttpHandler to display the Images.

I am storing Images both in database and folder.

Now I want to change the names of Images in folder as names of EmpNo whose I didn't change while uploading.

So need to fetch the Images names from database to compare them with the Image names in the folder and rename them.

How can i fetch or extract the image names from the binary data that i get from database using generic handler.

I have attached the code In handler for reference.

using System;
using System.Web;
using System.Data;
using System.Data.SqlClient;

public class Lab_14___ImageFetchingHandler : IHttpHandler
{
    public void ProcessRequest(HttpContext context)
    {
        SqlCoection vCo = new SqlCoection("server=localhost; database=Asp.netDemoWebsiteDatabase; Integrated Security = SSPI;");
        vCo.Open();
        String vQuery = "Select EmpImage from EmpImages where Empno=@id";
        SqlCommand vComm = new SqlCommand(vQuery, vCo);

        //Receive the Id from some Form
        String vId = context.Request.QueryString["id"];
        vComm.Parameters.AddWithValue("@id", vId);
        SqlDataReader vDr = vComm.ExecuteReader();
        while (vDr.Read())
        {
            context.Response.ContentType = "image/jpg";
            context.Response.BinaryWrite((byte[])vDr["EmpImage"]);

            [ Here I need the Images names to store in List or array.How?? ]
        }
        vCo.Close();
    }
    public bool IsReusable
    {
        get
        {
            retu false;
        }
    }

}

asked 34 secs ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 17 خرداد 1395 ساعت: 4:14

صفحه بندی