Error cannot convert type byte to byte

csharp , db Sweden
  • 13 years ago


    I'm quite new with c# and are trying to set up a webpage that will show products with images. I will store the image inside the database.I've been follow some example from a book, and have put in this piece of code:


    ProductImageSelectByIDData selectproductimage = new ProductImageSelectByIDData();
                selectproductimage.Product = this.Product;
                Product.ImageData = (byte[ ])selectproductimage.Get();
                ImageStream = new MemoryStream((byte [ ])Product.ImageData);

     What I've underline is the part that goes wrong. I get an error message when trying to compile the soultion in vs2005."Cannot convert type byte[] to byte"

    someone that have encounter the same issues?


  • 13 years ago

     I'd have said that "Cannot convert type byte[] to byte" is fairly self explanatory... in that you can't simply convert an array of information to a singular instance of the "type" of that array.

    What is the return type of selectproductimage.Get(); ?

    Following examples in books can sometimes be a real pain - more often than not I've found myself more confused by the (non) working examples than anything else.

     Here's something that might be of some help:



Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The greatest performance improvement of all is when a system goes from not-working to working.” - John Ousterhout