Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. OleDB Image

OleDB Image

Scheduled Pinned Locked Moved ASP.NET
databasetutorialquestion
8 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nc3b
    wrote on last edited by
    #1

    Please, anybody, I need to display an image from an access database. Can you show me how? I can't seem to get any of the example I've found to work

    N 1 Reply Last reply
    0
    • N nc3b

      Please, anybody, I need to display an image from an access database. Can you show me how? I can't seem to get any of the example I've found to work

      N Offline
      N Offline
      nc3b
      wrote on last edited by
      #2

      Oh come on guys, do I ask that much? I'm sure you know, it's not hard, it's just that I get a picture that "cannot be displayed" and when I look inside (with mozilla) I see /���� ���!�ÿÿÿÿBitmap Image�Paint.Picture���������PBrush����������Õ�BMöÔ�� and more stuff just like that. What am I doing wrong? OleDbCommand command=new OleDbCommand("SELECT imagine FROM produse WHERE produse.cod_produs=10",dbconn); Byte[] imagedata=(byte[])(command.ExecuteScalar()); Response.ContentType = "image/bmp"; Response.BinaryWrite(imagedata); :((

      G 1 Reply Last reply
      0
      • N nc3b

        Oh come on guys, do I ask that much? I'm sure you know, it's not hard, it's just that I get a picture that "cannot be displayed" and when I look inside (with mozilla) I see /���� ���!�ÿÿÿÿBitmap Image�Paint.Picture���������PBrush����������Õ�BMöÔ�� and more stuff just like that. What am I doing wrong? OleDbCommand command=new OleDbCommand("SELECT imagine FROM produse WHERE produse.cod_produs=10",dbconn); Byte[] imagedata=(byte[])(command.ExecuteScalar()); Response.ContentType = "image/bmp"; Response.BinaryWrite(imagedata); :((

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        nc3b wrote:

        Oh come on guys, do I ask that much?

        A bit patience perhaps? If you want 24/7 support with immediate response, you have to pay for it...

        nc3b wrote:

        Response.ContentType = "image/bmp"; Response.BinaryWrite(imagedata);

        Is it a bmp file that you have stored in the field?

        --- single minded; short sighted; long gone;

        N 1 Reply Last reply
        0
        • G Guffa

          nc3b wrote:

          Oh come on guys, do I ask that much?

          A bit patience perhaps? If you want 24/7 support with immediate response, you have to pay for it...

          nc3b wrote:

          Response.ContentType = "image/bmp"; Response.BinaryWrite(imagedata);

          Is it a bmp file that you have stored in the field?

          --- single minded; short sighted; long gone;

          N Offline
          N Offline
          nc3b
          wrote on last edited by
          #4

          Yes, it's bmp

          G 1 Reply Last reply
          0
          • N nc3b

            Yes, it's bmp

            G Offline
            G Offline
            Guffa
            wrote on last edited by
            #5

            Make sure that there is no markup in the page that gets sent along with the image data, only the @Page tag.

            --- single minded; short sighted; long gone;

            N 2 Replies Last reply
            0
            • G Guffa

              Make sure that there is no markup in the page that gets sent along with the image data, only the @Page tag.

              --- single minded; short sighted; long gone;

              N Offline
              N Offline
              nc3b
              wrote on last edited by
              #6

              There isn't, and more, I say response.Clear(); before BinaryWrite()

              1 Reply Last reply
              0
              • G Guffa

                Make sure that there is no markup in the page that gets sent along with the image data, only the @Page tag.

                --- single minded; short sighted; long gone;

                N Offline
                N Offline
                nc3b
                wrote on last edited by
                #7

                I looked into the source again and I tried Response.OutputStream.Write(imagedata,78,1000); But now mozilla doesn't say the immage cannot be displayed, it just doesn't print it.

                N 1 Reply Last reply
                0
                • N nc3b

                  I looked into the source again and I tried Response.OutputStream.Write(imagedata,78,1000); But now mozilla doesn't say the immage cannot be displayed, it just doesn't print it.

                  N Offline
                  N Offline
                  nc3b
                  wrote on last edited by
                  #8

                  I did it. Just omit the first 78 bytes from the file. After this wonderful solution, I believe I won't let anyone persuade me again into writing aspx. Why I don't like aspx.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups