Copying Datatable to Excel or Access file?
Hi,
I just wanna know that is there any easy way to copy a Datatable's data(or Dataset) to an Excel file? My codes are below;
------------
SqlConnection bag_sql = new SqlConnection("Data Source=Mega;Initial Catalog=Config;User Id=WindsCm;Password=1abc;");
bag_sql.Open();
OleDbConnection bag_excel = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=hw.xlsx;Extended Properties=Excel 12.0 Xml;");
bag_excel.Open();
String query_router="SELECT * FROM Node WHERE Node_City='NY'";
SqlDataAdapter oadp = new SqlDataAdapter(query_router, bag_sql);
DataTable tbl_router = new DataTable();
oadp.Fill(tbl_router);
...
---------------