Click here to Skip to main content
15,899,679 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Uncommon reason - Object reference not set to an instance of an object. Pin
TheyCallMeMrJames17-May-10 6:16
TheyCallMeMrJames17-May-10 6:16 
GeneralRe: Uncommon reason - Object reference not set to an instance of an object. Pin
DonnieHunniecutt17-May-10 6:41
DonnieHunniecutt17-May-10 6:41 
AnswerRe: Uncommon reason - Object reference not set to an instance of an object. Pin
Eddy Vluggen17-May-10 0:22
professionalEddy Vluggen17-May-10 0:22 
GeneralRe: Uncommon reason - Object reference not set to an instance of an object. Pin
DonnieHunniecutt17-May-10 1:59
DonnieHunniecutt17-May-10 1:59 
QuestionHow to export arabic data to csv? Pin
Athul from Sharjah16-May-10 3:17
Athul from Sharjah16-May-10 3:17 
AnswerRe: How to export arabic data to csv? Pin
sweet_light7-Sep-10 0:17
sweet_light7-Sep-10 0:17 
QuestionRoleManager issues with SharePoint FBA Pin
BaggyG16-May-10 2:02
BaggyG16-May-10 2:02 
Questionwhere to give image url to display image [modified] Pin
developerit15-May-10 21:06
developerit15-May-10 21:06 
 string branchid = "";
    protected void Page_Load(object sender, EventArgs e)
    {
      branchid= Session["branchid"].ToString();
         
      Response.ContentType = "image/jpeg";
      Stream strm = ShowImage(branchid);
     
      byte[] buffer = new byte[4096];
      int byteSeq = strm.Read(buffer, 0, 4096);

      while (byteSeq > 0)
      {
           Response.OutputStream.Write(buffer, 0, byteSeq);
          byteSeq = strm.Read(buffer, 0, 4096);
      }
Image1.imageurl=byteSeq;
}


public Stream ShowImage(string branchid)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Safa"].ConnectionString);
        string sql = "SELECT imgleft1 FROM tblImages WHERE BranchId = @BranchId";
        SqlCommand cmd = new SqlCommand(sql, con);
        cmd.CommandType = CommandType.Text;
        cmd.Parameters.AddWithValue("@BranchId", branchid);
        con.Open();
        object img = cmd.ExecuteScalar();

        try
        {
            return new MemoryStream((byte[])img);
        }
        catch
        {
            return null;
        }
        finally
        {
            con.Close();
        }
    }


hi iam using asp.net with c#

iam retreving image from database but i want to display in

image1.imageurl
but it is not displaying image
can you correct my code

modified on Sunday, May 16, 2010 8:59 AM

AnswerRe: where to give image url to display image Pin
Not Active16-May-10 2:31
mentorNot Active16-May-10 2:31 
AnswerRe: where to give image url to display image Pin
michaelschmitt17-May-10 0:09
michaelschmitt17-May-10 0:09 
QuestionDatabase Error when retrieving specific records from a table Pin
Eagle3215-May-10 11:26
Eagle3215-May-10 11:26 
AnswerRe: Database Error when retrieving specific records from a table Pin
Tarakeshwar Reddy15-May-10 12:41
professionalTarakeshwar Reddy15-May-10 12:41 
AnswerRe: Database Error when retrieving specific records from a table Pin
hyjiacan15-May-10 14:27
hyjiacan15-May-10 14:27 
GeneralRe: Database Error when retrieving specific records from a table Pin
Tarakeshwar Reddy15-May-10 17:20
professionalTarakeshwar Reddy15-May-10 17:20 
QuestionError trying to set the style sheet in the code behind. Pin
Steve Holdorf15-May-10 9:45
Steve Holdorf15-May-10 9:45 
AnswerRe: Error trying to set the style sheet in the code behind. Pin
Not Active15-May-10 17:23
mentorNot Active15-May-10 17:23 
QuestionWeb Server serving as a TCP/IP communication server as well Pin
Stevo Z15-May-10 4:58
Stevo Z15-May-10 4:58 
AnswerRe: Web Server serving as a TCP/IP communication server as well Pin
DeepToot18-May-10 8:39
DeepToot18-May-10 8:39 
GeneralRe: Web Server serving as a TCP/IP communication server as well Pin
Stevo Z18-May-10 11:05
Stevo Z18-May-10 11:05 
Questiondata problem Pin
bapu288915-May-10 0:58
bapu288915-May-10 0:58 
AnswerRe: data problem Pin
Not Active15-May-10 3:03
mentorNot Active15-May-10 3:03 
QuestionRe: data problem Pin
bapu288915-May-10 6:59
bapu288915-May-10 6:59 
AnswerRe: data problem Pin
Not Active15-May-10 7:24
mentorNot Active15-May-10 7:24 
GeneralRe: data problem Pin
bapu288915-May-10 7:43
bapu288915-May-10 7:43 
QuestionMaster-Content Page postback issues Pin
trunkwala_abbas15-May-10 0:07
trunkwala_abbas15-May-10 0:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.