Click here to Skip to main content
15,884,353 members
Home / Discussions / C#
   

C#

 
AnswerRe: wcf object serialization without datacontract/datamemember attributes strange behavior Pin
Gerry Schmitz3-Sep-14 10:24
mveGerry Schmitz3-Sep-14 10:24 
Questionviewing photo from MySQL Pin
Jassim Rahma3-Sep-14 0:58
Jassim Rahma3-Sep-14 0:58 
QuestionRe: viewing photo from MySQL Pin
Richard MacCutchan3-Sep-14 1:30
mveRichard MacCutchan3-Sep-14 1:30 
AnswerRe: viewing photo from MySQL Pin
Jassim Rahma3-Sep-14 1:41
Jassim Rahma3-Sep-14 1:41 
GeneralRe: viewing photo from MySQL Pin
Richard Deeming3-Sep-14 1:42
mveRichard Deeming3-Sep-14 1:42 
GeneralRe: viewing photo from MySQL Pin
Jassim Rahma3-Sep-14 1:46
Jassim Rahma3-Sep-14 1:46 
GeneralRe: viewing photo from MySQL Pin
Jassim Rahma3-Sep-14 1:48
Jassim Rahma3-Sep-14 1:48 
GeneralRe: viewing photo from MySQL Pin
Richard Deeming3-Sep-14 1:54
mveRichard Deeming3-Sep-14 1:54 
You haven't reset the position of the MemoryStream before you try to read it with the BinaryReader, so I suspect you're saving an empty byte array to the database.

Since you're using a MemoryStream, you don't need to worry about the BinaryReader - just use the ToArray method[^] instead:
C#
using (var memoryStream = new MemoryStream())
{
    pictureEmployee.Image.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Png);
    
    byte[] employee_photo = memoryStream.ToArray();
    sql_command.Parameters.AddWithValue("param_photo", employee_photo).MySqlDbType = MySqlDbType.Blob;
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: viewing photo from MySQL Pin
Jassim Rahma3-Sep-14 2:26
Jassim Rahma3-Sep-14 2:26 
GeneralRe: viewing photo from MySQL Pin
Jassim Rahma3-Sep-14 2:36
Jassim Rahma3-Sep-14 2:36 
GeneralRe: viewing photo from MySQL Pin
Richard Deeming3-Sep-14 2:43
mveRichard Deeming3-Sep-14 2:43 
GeneralRe: viewing photo from MySQL Pin
Dave Kreskowiak3-Sep-14 3:45
mveDave Kreskowiak3-Sep-14 3:45 
GeneralRe: viewing photo from MySQL Pin
Richard Deeming3-Sep-14 3:52
mveRichard Deeming3-Sep-14 3:52 
GeneralRe: viewing photo from MySQL Pin
Jassim Rahma3-Sep-14 4:12
Jassim Rahma3-Sep-14 4:12 
Questioncalculating total time betweem time ranges Pin
devil54e3-Sep-14 0:28
devil54e3-Sep-14 0:28 
AnswerRe: calculating total time betweem time ranges Pin
Richard MacCutchan3-Sep-14 0:55
mveRichard MacCutchan3-Sep-14 0:55 
GeneralRe: calculating total time betweem time ranges Pin
devil54e3-Sep-14 1:12
devil54e3-Sep-14 1:12 
GeneralRe: calculating total time betweem time ranges Pin
Richard MacCutchan3-Sep-14 1:28
mveRichard MacCutchan3-Sep-14 1:28 
GeneralRe: calculating total time betweem time ranges Pin
devil54e3-Sep-14 2:13
devil54e3-Sep-14 2:13 
AnswerRe: calculating total time betweem time ranges Pin
Pete O'Hanlon3-Sep-14 1:09
mvePete O'Hanlon3-Sep-14 1:09 
GeneralRe: calculating total time betweem time ranges Pin
devil54e3-Sep-14 1:17
devil54e3-Sep-14 1:17 
AnswerRe: calculating total time betweem time ranges Pin
Richard Deeming3-Sep-14 1:41
mveRichard Deeming3-Sep-14 1:41 
GeneralRe: calculating total time betweem time ranges Pin
devil54e3-Sep-14 2:12
devil54e3-Sep-14 2:12 
GeneralRe: calculating total time betweem time ranges Pin
Richard Deeming3-Sep-14 2:18
mveRichard Deeming3-Sep-14 2:18 
GeneralRe: calculating total time betweem time ranges Pin
devil54e3-Sep-14 2:32
devil54e3-Sep-14 2:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.