Click here to Skip to main content
15,893,588 members
Home / Discussions / C#
   

C#

 
GeneralRe: problem writing in doc file Pin
Dhyanga21-Jul-10 5:48
Dhyanga21-Jul-10 5:48 
AnswerRe: problem writing in doc file Pin
OriginalGriff21-Jul-10 5:39
mveOriginalGriff21-Jul-10 5:39 
GeneralRe: problem writing in doc file Pin
Dhyanga21-Jul-10 5:42
Dhyanga21-Jul-10 5:42 
GeneralRe: problem writing in doc file Pin
OriginalGriff21-Jul-10 5:51
mveOriginalGriff21-Jul-10 5:51 
GeneralRe: problem writing in doc file Pin
Dhyanga21-Jul-10 5:54
Dhyanga21-Jul-10 5:54 
GeneralRe: problem writing in doc file Pin
OriginalGriff21-Jul-10 6:03
mveOriginalGriff21-Jul-10 6:03 
GeneralRe: problem writing in doc file Pin
Dhyanga21-Jul-10 6:09
Dhyanga21-Jul-10 6:09 
GeneralRe: problem writing in doc file Pin
OriginalGriff21-Jul-10 8:54
mveOriginalGriff21-Jul-10 8:54 
OK, this won't fix your problem (though it may appear to in a way). Alter your try block to include a finally block as well, and move the Response.End to there:
try
{
    i = 0;
    dr = cmd.ExecuteReader();
    while (dr.Read())
    {
        HttpContext.Current.Response.Write( dr[0].ToString());
        i++;
    }
    for (int j = 0; j < i; j++)
    {
        temp += s[j]+ '\n';
    }
}
catch(Exception ex)
{
    string pt = ex.ToString();
}
finally
{
     HttpContext.Current.Response.End();
}
What this does is ensure that whatever you have written to the HttpContext will get written to your client, whether it fails or not.
THIS DOES NOT FIX THE PROBLEM!
You should find that some of your data is written, and some is not, which should give you a clue as to what is going wrong.
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.

GeneralRe: problem writing in doc file Pin
Dhyanga21-Jul-10 9:44
Dhyanga21-Jul-10 9:44 
GeneralRe: problem writing in doc file Pin
OriginalGriff21-Jul-10 9:51
mveOriginalGriff21-Jul-10 9:51 
GeneralRe: problem writing in doc file Pin
Dhyanga21-Jul-10 10:10
Dhyanga21-Jul-10 10:10 
GeneralRe: problem writing in doc file Pin
OriginalGriff21-Jul-10 21:55
mveOriginalGriff21-Jul-10 21:55 
GeneralRe: problem writing in doc file Pin
Dhyanga22-Jul-10 3:00
Dhyanga22-Jul-10 3:00 
GeneralRe: problem writing in doc file Pin
OriginalGriff22-Jul-10 3:49
mveOriginalGriff22-Jul-10 3:49 
GeneralRe: problem writing in doc file Pin
Dhyanga22-Jul-10 4:14
Dhyanga22-Jul-10 4:14 
GeneralRe: problem writing in doc file [modified] Pin
Dhyanga22-Jul-10 4:17
Dhyanga22-Jul-10 4:17 
QuestionLine on open/close brackets Pin
Blubbo21-Jul-10 4:26
Blubbo21-Jul-10 4:26 
AnswerRe: Line on open/close brackets Pin
Ennis Ray Lynch, Jr.21-Jul-10 4:36
Ennis Ray Lynch, Jr.21-Jul-10 4:36 
AnswerRe: Line on open/close brackets Pin
OriginalGriff21-Jul-10 4:56
mveOriginalGriff21-Jul-10 4:56 
AnswerRe: Line on open/close brackets Pin
PIEBALDconsult21-Jul-10 18:22
mvePIEBALDconsult21-Jul-10 18:22 
Questionconvert date question Pin
Jassim Rahma21-Jul-10 3:36
Jassim Rahma21-Jul-10 3:36 
AnswerRe: convert date question Pin
OriginalGriff21-Jul-10 3:46
mveOriginalGriff21-Jul-10 3:46 
AnswerRe: convert date question Pin
Luc Pattyn21-Jul-10 3:47
sitebuilderLuc Pattyn21-Jul-10 3:47 
Questionhow to open www.google.com and insert any text to the textbox search (only for show) Pin
Gali197821-Jul-10 3:32
Gali197821-Jul-10 3:32 
AnswerRe: how to open www.google.com and insert any text to the textbox search (only for show) Pin
Luc Pattyn21-Jul-10 3:46
sitebuilderLuc Pattyn21-Jul-10 3:46 

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.