TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
gamedev
NA
6
0
get byte[] from a database
Feb 6 2005 8:55 AM
I've saved an image (converting in byte[]) inside a field of my database, now i would read the database getting these bytes[] and convertering into the original image... I use this code: OleDbDataReader myReader; .... .. instance myReader here... .... myCommand.ExecuteReader(); MemoryStream myStream; int buffersize = 300000; // doubt n°2 = but if my image is bigger of 300000 ??? Byte[] outbyte = new Byte[299999]; myStream = new MemoryStream(outbyte, 0, 300000, true); myReader.GetBytes(5, 0, outbyte, 0, buffersize); myStream.Flush(); // am i just deleting all bytes unused? pictureBox1.Image = Image.FromStream(myStream); myStream.Close(); but this code doesn't work, where do i wrong? Then I've tried to change the code in this way: MemoryStream myStream; Byte[] outbyte = (Byte[])myReader["Image"]; myStream = new MemoryStream(outbyte); pictureBox1.Image = Image.FromStream(myStream); myStream.Close(); but this doesn't work too.
Reply
Answers (
1
)
Impementing RSA in ASP.NET
ado.net