For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > September 2004 > bigger buffer corrupts file









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author bigger buffer corrupts file
Tomas PAJER

2004-09-30, 8:59 pm

Hi, I am really done. What is wrong with this simple code? Buffer with size
smaller than about 500 works. But bigger buffer results in corrupted file.
Generated file is bigger than the original (about 10 kB). Why? File is stored
in MS SQL server 2000. Thank you. Tom


if (dr.Read())
{

startIndex = 0;
this.retval = dr.GetBytes(2,startIndex,buffer,0,this.bufferSize);

while (this.retval == this.bufferSize)
{
Response.BinaryWrite(this.buffer);
Response.Flush();
this.startIndex += this.bufferSize;
this.retval = dr.GetBytes(2,startIndex,buffer,0,this.bufferSize);
}
Response.BinaryWrite(this.buffer);
Response.Flush();

Response.End();
}
dr.Close();



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com