binary data help

cocol

Active member
Joined
Jul 23, 2010
Messages
30
Programming Experience
Beginner
hello!
i need your help to know witch control i can use to hold within it a binary data.
so i have binary data in database and i want to retrieve all the binary data and put them into this control to reduce the connection to the database.
thank you for help!:D
 
For a start, it's not going to be a control, is it? A control is something you use to display data to the user and/or accept user input. You're not going to be displaying this binary data to the user, are you? If not then you don't want a control.

I think you probably ought to provide a more complete explanation of what you're trying to achieve, e.g. what does this data represent, how much of it is there, etc. Sometimes it is better to get all your data in one go and then work with it locally and other times it is better to go back to the database multiple times. We can't know which this is without a better explanation.

To answer your question specifically, binary data comes from a database via ADO.NET as a Byte array, so if you want to store it locally then that's what you store it as: a Byte array.
 
thank you for your reply.
i have hundreds of images stored in database so when i need an image i want to connect to the database,so sometimes the time expires for the connection ,because i connect so many to it because i have 4 images and a button ="next" so when i click in next a new 4 images will come so a new connection to database,all this and i am just one user and the connection expires,so if there are many users ,i think the connection to the database will be impossible.
so i want a control that support array of bytes and this control will be hidden ,so when i need an image i transform this array of bytes in this control to image .
thank you!
 
First up, is it really appropriate that these images be stored in the database in the first place? Are they being accessed and changed by multiple users? If not then they shouldn't be in the database at all. In that case it would be more appropriate to embed them as resources in a DLL.

If you do keep them in the database then you DO NOT need a hidden control, as I have already said. You get the data from the database and you convert the Byte array to an Image and that's how you store it: as an Image. You can then display that Image as appropriate when needed, e.g. assign it to the Image property of a PictureBox. if you only need to display one Image at a time then you only need one control, not lots of controls that hide and show.
 
first i want to ask :i know that if i add an image and i choose in the property of the image: embeded resource (in build action)so it will be stored.and i know if i create a custom control the result will be a dll file,so what did you mean about "to embed them as resources in a DLL" ?
second:the pictures should be in the database so i want to retrieve all the pictures from database not only one by one so i understand what you say but the fact it's a website in asp.net so i have the server side that destroy or reset any global variable like the sqlreader do i want to store what i retrieve in a control so i tried gridview in asp.net and it doesn't work for the byte array,so i post this thread in vb.net to know if i have any control so the equivalent in asp.net controls will exist .
thank you.
 
Thread moved to ASP.NET section of forums.
 
Back
Top