如何将数据集导出到html文件并保存在文件夹中? [英] how to export dataset into html file and save in a folder?

查看:218
本文介绍了如何将数据集导出到html文件并保存在文件夹中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

string Constring = ConfigurationManager.ConnectionStrings [MyCon] .ConnectionString;

SqlConnection sqlcon = new SqlConnection(Constring);

SqlCommand sqlCom = new SqlCommand(Select *来自tblGallery,sqlcon);

sqlcon.Open();

DataSet ds = new DataSet();

SqlDataAdapter da = new SqlDataAdapter(sqlCom);

DataTable dt = new DataTable();

da.Fill(dt);

dt.TableName =Gallery ;

ds.Tables.Add(dt);



我有数据集中的数据,现在我要生成html文件包含数据集中的数据,

html文件应该自动保存在文件夹中,并且还会在单击事件中邮寄该html文件的附件。请帮助

解决方案

HI,

选中此链接将Datatable导出为HTML文件:



http://forums.asp.net/t /1093574.aspx?convert+a+DataTable+to+HTML [ ^ ]



http://stackoverflow.com/questions/9792882/creating-html-from-a-datatable-using-c-sharp [ ^ ]

string Constring = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString;
SqlConnection sqlcon = new SqlConnection(Constring);
SqlCommand sqlCom = new SqlCommand("Select * from tblGallery", sqlcon);
sqlcon.Open();
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(sqlCom);
DataTable dt = new DataTable();
da.Fill(dt);
dt.TableName = "Gallery";
ds.Tables.Add(dt);

I have the data in dataset,now i want to generate html file of containing data present in dataset,
that html file should automatically save in folder and also mailed with attachment of that html file on single click event..Please help

解决方案

HI,
check this link to export Datatable to HTML file :

http://forums.asp.net/t/1093574.aspx?convert+a+DataTable+to+HTML[^]

http://stackoverflow.com/questions/9792882/creating-html-from-a-datatable-using-c-sharp[^]


这篇关于如何将数据集导出到html文件并保存在文件夹中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆