Professional Web Applications Themes

Question about 'image' data type in SQL Server - Microsoft SQL / MS SQL Server

Brandon, I think that the following doent in the .NET framework doentation will help. It is titled "Conserving Resources When Writing BLOB Values to SQL Server" and it is located at (watch for line wrap): [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconconservingresourceswhenwritingblobvaluestosql server.asp[/url] You should check the code you are using to insert and retrieve the image from the database against this code. Hope this helps. -- - Nicholas Paldino [.NET/C# MVP] - [email]nicholas.paldinoexisconsulting.com[/email] "Brandon" <brandonparks.ms> wrote in message news:4e7c4745.0307111157.5e3fbbdcposting.google.c om... > I'm writing an application that stores .tiff images in a database to > be viewed later on the web. Currently, all is well with ...

  1. #1

    Default Re: Question about 'image' data type in SQL Server

    Brandon,

    I think that the following doent in the .NET framework doentation
    will help. It is titled "Conserving Resources When Writing BLOB Values to
    SQL Server" and it is located at (watch for line wrap):

    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconconservingresourceswhenwritingblobvaluestosql server.asp[/url]

    You should check the code you are using to insert and retrieve the image
    from the database against this code.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - [email]nicholas.paldinoexisconsulting.com[/email]

    "Brandon" <brandonparks.ms> wrote in message
    news:4e7c4745.0307111157.5e3fbbdcposting.google.c om...
    > I'm writing an application that stores .tiff images in a database to
    > be viewed later on the web. Currently, all is well with this
    > application, but in looking at a few things, I've begun to wonder how
    > SQL is storing these images. I know that curiosity killed the cat, so
    > I guess you can call me Sylvester. :)
    >
    > I have an example to explain my question here. I stored some binary
    > data that represents a tiff image to the database. This particular
    > blob of binary data, in the original file I pulled it from, is 9330
    > bytes long, and, since it's binary, it contains all manner of garbage
    > when viewed in the text editor. Looking at in the binary viewer in
    > VS.NET, it has a nice mix of hex numbers in the range 0-F. Now, after
    > this was written out to SQL Server and I look at the field, It is much
    > shorter and the Hex is much less complex...lots of zeros. So,
    >
    > I was wondering, does SQL Server actually display the binary data when
    > you run a query or does it display some sort of internal pointer to
    > disk which is where it stores the image??? The real thing that got my
    > curiosity up on this is that I've stored approximately 1800 files this
    > way, and out of those, 1 is not getting extracted properly. Anyway,
    > any info appreciated.
    >
    > Cheers,
    > Brandon

    Nicholas Paldino [.NET/C# MVP] Guest

  2. #2

    Default Re: Question about 'image' data type in SQL Server

    Nicholas,

    Thanks for the good information about the image types. As it turns out
    though, I believe my problem is in the buffering on the file stream.
    I'm switching back and forth between a StreamReader and a BinaryReader
    on the same FileStream object. I keep up with the current position in
    the file locally, so that I can seek to the proper location in the
    file. But, apparently at some points, the file stream ignores my seek.
    It uses the FS.buffer to begin with, returning the bytes in that
    buffer, then, when that is used up, it scans to the nextRead position
    to give the rest. Ahh, the joys of programming. Not sure what I'm
    going to do about this. It's driving me batty. I've done a
    DiscardBufferedData call on the stream reader and a Flush on the file
    stream before reading the bytes for the image, but I'm still getting
    the wrong bytes. Anyway, I've started another thread regarding this
    problem under ms.public.dotnet.languages.csharp. I think I titled it
    'multiple readers on same file stream' or something similar, in case
    you want to watch the thread or perhaps contribute.... Thanks again
    for the input.

    -Brandon


    "Nicholas Paldino [.NET/C# MVP]" <com> wrote in message news:<eScR1h#phx.gbl>... [/ref]
    Brandon Guest

Similar Threads

  1. SQL Server DateTime Data Type
    By dpinder123 in forum Coldfusion Database Access
    Replies: 1
    Last Post: September 2nd, 04:11 PM
  2. Converting from data type varchar to data type money
    By schaudry in forum Coldfusion - Advanced Techniques
    Replies: 6
    Last Post: June 10th, 11:01 PM
  3. Image data from Sql server to asp.net
    By seeni in forum ASP.NET Building Controls
    Replies: 3
    Last Post: December 24th, 08:18 AM
  4. Replies: 3
    Last Post: October 18th, 06:56 AM
  5. Replies: 2
    Last Post: October 16th, 08:29 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139