SQLDataReader for image type
-
SQLDataReader should read from the stream. When the incoming stream has image type info [for example, images from a Sql server], the reader can only read a single image. I wonder what is happening. Apparently, a mixed stream is hard to read: -------------------------------- while drPic.read Response.ContentType = "image/bmp" Response.BinaryWrite(drPic.Item("pic")) end while -------------------------------- It has 20 pictures, but I get only one. If I add any other fields, they get skipped.
-
SQLDataReader should read from the stream. When the incoming stream has image type info [for example, images from a Sql server], the reader can only read a single image. I wonder what is happening. Apparently, a mixed stream is hard to read: -------------------------------- while drPic.read Response.ContentType = "image/bmp" Response.BinaryWrite(drPic.Item("pic")) end while -------------------------------- It has 20 pictures, but I get only one. If I add any other fields, they get skipped.
I've never used image types in SQL Server, but, are all the images in the same field? Or do you get all the images, each from one field, and try to output all of them with
Reponse.BinaryWrite
? If you are trying to output all of them to the browser, then probably you should generate an HTML file that contains all the images. I don't the browser supports displaying multiple images by themselves at once (ie. several URLs for JPG files, one after another) I've never worked with it, but just an idea. -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
-
I've never used image types in SQL Server, but, are all the images in the same field? Or do you get all the images, each from one field, and try to output all of them with
Reponse.BinaryWrite
? If you are trying to output all of them to the browser, then probably you should generate an HTML file that contains all the images. I don't the browser supports displaying multiple images by themselves at once (ie. several URLs for JPG files, one after another) I've never worked with it, but just an idea. -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
Luis: Let's say you are writing out the column that contains 8 rows of, say text (string type), the Execute Reader will get you 8 rows of data for that column assuming you arranged it that way. On the other hand if the 8 rows had data of type image, the Response.Binary write seems to write just the first row and nothing else. I am a bit surprised, but trying to find why this happens?. Also if you wanted both text and image to be read out, it looks like there is something that prevents writing text and image, you get image only. I have been trying several tricks, but so far not much of a success. If I succeed I will let you know. mysorian:~
-
Luis: Let's say you are writing out the column that contains 8 rows of, say text (string type), the Execute Reader will get you 8 rows of data for that column assuming you arranged it that way. On the other hand if the 8 rows had data of type image, the Response.Binary write seems to write just the first row and nothing else. I am a bit surprised, but trying to find why this happens?. Also if you wanted both text and image to be read out, it looks like there is something that prevents writing text and image, you get image only. I have been trying several tricks, but so far not much of a success. If I succeed I will let you know. mysorian:~
In your code, you're setting the response type to "image/bmp" and that's why if you output text into the response, you can't see it. When the response type is "image/bmp", the browser treats everything it gets as a single BMP file. If you send some text (or more images) they're treated as part of the first BMP file. Because of the format of BMP files, you can add data at the end of the file and the image won't be corrupted. So, no matter what you output to the browser, you only see the first image you send. If you want to see multiple files, you would have to build on the fly an HTML file full of IMG tags. -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
-
In your code, you're setting the response type to "image/bmp" and that's why if you output text into the response, you can't see it. When the response type is "image/bmp", the browser treats everything it gets as a single BMP file. If you send some text (or more images) they're treated as part of the first BMP file. Because of the format of BMP files, you can add data at the end of the file and the image won't be corrupted. So, no matter what you output to the browser, you only see the first image you send. If you want to see multiple files, you would have to build on the fly an HTML file full of IMG tags. -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
-
Thanks. I did try that, may be something else was not correct. Back to the board I think. :eek: mysorian
You're welcome. We're here to help! Good luck! -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!