// insert code here.. 1. Database db = DatabaseFactory.CreateDatabase(); 2. DBCommandWrapper selectCommandWrapper = db.GetStoredProcCommandWrapper("sp_GetLatestArticles"); 3. DataSet ds = db.ExecuteDataSet(selectCommandWrapper); 4. StringBuilder str = new StringBuilder(); 5. for(int i=0;i<=ds.Tables[0].Rows.Count - 1; i++) 6. { 7. for(int j=0;j<=ds.Tables[0].Columns.Count - 1; j++) 8. { 9. str.Append(ds.Tables[0].Rows[i][j].ToString()); 10. } 11. str.Append("<BR>"); 12. } 13. Response.Clear(); 14. Response.AddHeader("content-disposition", "attachment;filename=FileName.txt"); 15. Response.Charset = ""; 16. Response.Cache.SetCacheability(HttpCacheability.NoCache); 17. Response.ContentType = "application/vnd.text"; 18. System.IO.StringWriter stringWrite = new System.IO.StringWriter(); 19. System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); 20. Response.Write(str.ToString()); Response.End();
You need to create an account or log in to post comments to this site.