当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 将dataset以xml形式发给客户端下载

ASP.NET
HTML服务器控件介绍:HtmlInputFile控件
HTML服务器控件介绍:HtmlInputHidden控件
HTML服务器控件介绍:HtmlInputImage控件
HTML服务器控件介绍:HtmlInputRadioButton控件
HTML服务器控件介绍:HtmlInputText控件
HTML服务器控件介绍:HtmlSelect控件
HTML服务器控件介绍:HtmlTable控件
HTML服务器控件介绍:HtmlTableCell控件
HTML服务器控件介绍:HtmlTableRow控件
HTML服务器控件介绍:HtmlTextArea控件
Web服务器控件:AdRotator控件
Web服务器控件:Button控件
Web服务器控件:Calendar控件
Web服务器控件:CheckBox控件
Web服务器控件:CheckBoxList控件
Web服务器控件:DropDownList控件
Web服务器控件:HyperLink控件
Web服务器控件:Image控件
Web服务器控件:ImageButton控件
Web服务器控件:Label控件

ASP.NET 中的 将dataset以xml形式发给客户端下载


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 224 ::
收藏到网摘: n/a

SendDataSetasxmlfile.

//CreateMemeoryStream
System.IO.MemoryStreamms=newSystem.IO.MemoryStream();

//WriteMemeoryStream

MyDataset.WriteXml(ms,System.Data.XmlWriteMode.IgnoreSchema);

Response.Clear();

//filename&attachment

Response.AddHeader("Content-Disposition","attachment;filename=Acounts.xml");

//sizeofthefile,toshowprocessofdownloading

Response.AddHeader("Content-Length",ms.Length.ToString());

//mode:download

Response.ContentType="application/octet-stream";

//sendingtoclient

byte[]b=ms.ToArray();

Response.OutputStream.Write(b,0,b.Length);

Response.End();

}