最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
把dataset作为一个xml文件传给客户端
时间:2022-06-30 10:46:25 编辑:袖梨 来源:一聚教程网
把它直接放在内存中,然后传给客户端
// 创建MemeoryStream
System.IO.MemoryStream ms = new System.IO.MemoryStream();
// 写dataset到MemeoryStream
dataset1.WriteXml(ms,System.Data.XmlWriteMode.IgnoreSchema);
// 写dataset到MemeoryStream
dataset1.WriteXml(ms,System.Data.XmlWriteMode.IgnoreSchema);
Response.Clear();
// 下载附件的名字// 下载附件的名字
Response.AddHeader("Content-Disposition", "attachment; filename=Acounts.xml");
// 下载附件的大小,以便让浏览器显示进度条
"Content-Disposition", "attachment; filename=Acounts.xml");
// 下载附件的大小,以便让浏览器显示进度条// 下载附件的大小,以便让浏览器显示进度条
Response.AddHeader("Content-Length", ms.Length.ToString());
// 指定浏览器为下载模式
"Content-Length", ms.Length.ToString());
// 指定浏览器为下载模式// 指定浏览器为下载模式
Response.ContentType = "application/octet-stream";
// 发送到客户端
"application/octet-stream";
// 发送到客户端// 发送到客户端
byte[] b = ms.ToArray();
Response.OutputStream.Write(b,0,b.Length);
Response.End();
}
byte[] b = ms.ToArray();
Response.OutputStream.Write(b,0,b.Length);
Response.End();
}
Response.End();
}
相关文章
- boss智能门锁如何设置密码 04-29
- 王者荣耀世界橘右京厉害吗 04-29
- 《青云劫攻略天赋技能,成就无敌仙侠》(解锁潜能,掌握绝学,成就仙侠传奇) 04-29
- 桃源深处有人家藏经室悟证一至七日通关答案 04-29
- 怎么击败《Saros》中的“破碎崛起”先知 Boss 04-29
- 宫小攻略技能推荐2023(玩转宫小,轻松游戏攻略指南) 04-29