Click here to Skip to main content
15,905,874 members
Home / Discussions / C#
   

C#

 
QuestionChart with CrystalReport Pin
Mohammad Dayyan20-Jan-09 16:46
Mohammad Dayyan20-Jan-09 16:46 
AnswerRe: Chart with CrystalReport Pin
N a v a n e e t h20-Jan-09 17:19
N a v a n e e t h20-Jan-09 17:19 
GeneralRe: Chart with CrystalReport Pin
Mohammad Dayyan20-Jan-09 17:37
Mohammad Dayyan20-Jan-09 17:37 
QuestionWeb Form Design Question Pin
JasonBerb20-Jan-09 15:08
JasonBerb20-Jan-09 15:08 
AnswerRe: Web Form Design Question Pin
N a v a n e e t h20-Jan-09 17:21
N a v a n e e t h20-Jan-09 17:21 
Questionicon changes when apps are grouped in taskbar Pin
rbuchana20-Jan-09 14:54
rbuchana20-Jan-09 14:54 
AnswerRe: icon changes when apps are grouped in taskbar Pin
Guffa20-Jan-09 15:01
Guffa20-Jan-09 15:01 
GeneralRe: icon changes when apps are grouped in taskbar Pin
rbuchana20-Jan-09 15:14
rbuchana20-Jan-09 15:14 
QuestionCryptography Pin
Scalee20-Jan-09 13:47
Scalee20-Jan-09 13:47 
AnswerRe: Cryptography Pin
Mark Churchill20-Jan-09 14:43
Mark Churchill20-Jan-09 14:43 
AnswerRe: Cryptography Pin
Guffa20-Jan-09 14:46
Guffa20-Jan-09 14:46 
QuestionHow to use WSDL in VS2008 Pin
Scott Elder20-Jan-09 13:31
Scott Elder20-Jan-09 13:31 
QuestionDataGridView, RowEnter exception upon header select Pin
Lodeclaw20-Jan-09 11:46
Lodeclaw20-Jan-09 11:46 
AnswerRe: DataGridView, RowEnter exception upon header select Pin
Lodeclaw20-Jan-09 11:53
Lodeclaw20-Jan-09 11:53 
QuestionSession states between two pages with two gridtables Pin
CrimeanTurtle200820-Jan-09 11:40
CrimeanTurtle200820-Jan-09 11:40 
AnswerRe: Session states between two pages with two gridtables Pin
Colin Angus Mackay20-Jan-09 13:13
Colin Angus Mackay20-Jan-09 13:13 
GeneralRe: Session states between two pages with two gridtables Pin
CrimeanTurtle200820-Jan-09 13:29
CrimeanTurtle200820-Jan-09 13:29 
QuestionStream / MemoryStream Pin
Jacob D Dixon20-Jan-09 11:18
Jacob D Dixon20-Jan-09 11:18 
AnswerRe: Stream / MemoryStream Pin
Wendelius20-Jan-09 11:47
mentorWendelius20-Jan-09 11:47 
GeneralRe: Stream / MemoryStream Pin
Jacob D Dixon20-Jan-09 12:32
Jacob D Dixon20-Jan-09 12:32 
AnswerRe: Stream / MemoryStream Pin
Ennis Ray Lynch, Jr.20-Jan-09 12:46
Ennis Ray Lynch, Jr.20-Jan-09 12:46 
AnswerRe: Stream / MemoryStream Pin
Guffa20-Jan-09 12:56
Guffa20-Jan-09 12:56 
Jacob D Dixon wrote:
FileData = myReader["Saved_File"].ToString();


You are getting the data as a byte array, but then you call the ToString method on the data. The Array class does not override the ToString method, so you are using the default implementation, which returns the name of the class. So, that line gives the same result as:

FileData = "System.Byte[]";

Jacob D Dixon wrote:
byte[] buffer = new byte[FileData.Length];


Here you are creating a new byte array with the size 13.

Jacob D Dixon wrote:
ms.Read(buffer, 0, FileData.Length);


Here you attemt to read the first 13 bytes from the memorystream. However, as you ignore the return value of the Read method, you don't know if you got one byte or 13 bytes. The Read method doesn't have to return the number of bytes that you requested, even if there are more bytes left in the stream, so you need to call Read in a loop until you have got all the data that you want, or until the method returns zero which means that it reached the end of the stream.

However, I have no idea why you are trying to read the data from the memory stream into a byte array, when you are using the memory stream in the attachment. Also I don't know where you think that you get the data from the data reader into either the memory stream or the buffer...

Despite everything, the person most likely to be fooling you next is yourself.

GeneralRe: Stream / MemoryStream Pin
Jacob D Dixon20-Jan-09 13:06
Jacob D Dixon20-Jan-09 13:06 
GeneralRe: Stream / MemoryStream Pin
Jacob D Dixon20-Jan-09 13:38
Jacob D Dixon20-Jan-09 13:38 
GeneralRe: Stream / MemoryStream Pin
Ben Fair21-Jan-09 2:36
Ben Fair21-Jan-09 2:36 

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.