Send DataSet as xml file.
// Create MemeoryStream
System.IO.MemoryStream ms = new System.IO.MemoryStream();
// Write MemeoryStream
MyDataset.WriteXml(ms,System.Data.XmlWriteMode.IgnoreSchema);
Response.Clear();
// filename & attachment
Response.AddHeader("Content-Disposition", "attachment; filename=Acounts.xml");
// size of the file,to show process of downloading
Response.AddHeader("Content-Length", ms.Length.ToString());
// mode:download
Response.ContentType = "application/octet-stream";
// sending to client
byte[] b = ms.ToArray();
Response.OutputStream.Write(b,0,b.Length);
Response.End();
}
Word教程网 | Excel教程网 | Dreamweaver教程网 | Fireworks教程网 | PPT教程网 | FLASH教程网 | PS教程网 |
HTML教程网 | DIV CSS教程网 | FLASH AS教程网 | ACCESS教程网 | SQL SERVER教程网 | C语言教程网 | JAVASCRIPT教程网 |
ASP教程网 | ASP.NET教程网 | CorelDraw教程网 |