Print Page | Close Window

Ideablade and image data type in SQL Server

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1055
Printed Date: 28-Apr-2025 at 8:52pm


Topic: Ideablade and image data type in SQL Server
Posted By: BillG
Subject: Ideablade and image data type in SQL Server
Date Posted: 09-Jan-2009 at 11:12am
I have a table that has a image data type.  Object mapper sees it as a byte[].
 
Here is my code to retrieve it.
 

RdbQuery query = new RdbQuery(typeof(MemberDocument));

query.AddClause(MemberDocument.DocumentIdEntityColumn, EntityQueryOp.EQ, id);

MemberDocument document = myPM.GetEntity<MemberDocument>(query);

byte[] imageData = document.DocumentImage;

MemoryStream mem = new MemoryStream(imageData);

return mem;

In my form I have the following

MemoryStream mem = myController.GetScannedImageById(id);

pictureBox1.Image = Bitmap.FromStream(mem);

I keep getting a parameter not valid when it tries to display it in the picture box.  Am I retrieving it properly and assigning it properly to a memorystream?
 
Bill
 



Replies:
Posted By: BillG
Date Posted: 09-Jan-2009 at 1:56pm
Resolved the problem.



Print Page | Close Window