Created
February 26, 2018 08:02
-
-
Save talkingdotnet/7442af2d823a0c4bd816c4dfada31ed2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ExtractData() | |
{ | |
try | |
{ | |
DataTable dtList = GetTableList(); | |
DataSet ds = new DataSet(); | |
foreach (DataRow row in dtList.Rows) | |
{ | |
string tableName = row[0].ToString(); | |
DataTable dtData = FetchData(tableName); | |
ds.Tables.Add(dtData); | |
} | |
if (ds.Tables.Count > 0) | |
{ | |
XmlSerializer ser = new XmlSerializer(typeof(DataSet)); | |
string xmlFileName = "Dbdata.xml"; | |
string fullPath = Path.Combine(_directoryPath, xmlFileName); | |
using (TextWriter writer = new StreamWriter(fullPath)) | |
{ | |
ser.Serialize(writer, ds); | |
writer.Close(); | |
} | |
PrepareZip(fullPath); | |
File.Delete(fullPath); | |
} | |
} | |
catch (Exception ex) { throw ex; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment