download to csv

///   <summary> 
///   CSV出力 
///   </summary> 
///   <param   name= "pCSV_NAME "> CSV_NAME </param> 
///   <param   name= "pCSV_CONTENT "> CSV_CONTENT </param> 
///   <param   name= "pResponse "> Response </param> 
///   <returns> </returns> 
///   <remarks> </remarks> 

public   static   bool   OUTPUT_CSV(string   pCSV_NAME,   string   pCSV_CONTENT,   HttpResponse   pResponse) 

HttpResponse   response1   
=   pResponse; 
string   text1   =   "GCom.OUTPUT_CSV "
if   (StringUtil.isNullOrZeroLength(pCSV_NAME)) 

return   false
}
 
if   (StringUtil.isNullOrZeroLength(pResponse)) 

return   false
}
 
try 

response1.Clear(); 
response1.Buffer   
=   true
response1.ContentType   
=   "application/octet-stream "
response1.AddHeader( 
"Content-Disposition ",   "attachment;filename= "   +   HttpUtility.UrlEncode(pCSV_NAME   +   ".CSV ",   Encoding.UTF8)); 
response1.BinaryWrite(Encoding.Default.GetBytes(pCSV_CONTENT)); 
response1.Flush(); 
response1.Close(); 
}
 
catch   (ThreadAbortException   exception3) 

Console.Write(exception3.Message); 
}
 
catch   (Exception   exception4) 

throw   new   LZException(text1,   exception4); 
}
 
return   true
}
posted @ 2007-11-13 17:53  Nina  阅读(300)  评论(0编辑  收藏  举报