in my program i have one data table that name is
DataTable dtCustInfo = custInfoMaster.SelectCustomerByMobileForCAF();
when i want write xml file form this tabel i got the error for what reasion it came
code:dtCustInfo.writeXml("d:\\mytext.xml");
what is the solution for this error the error is
Cannot serialize the DataTable. DataTable name is not set.
Write the xml file form data table error
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Praveen KumarRank #4 · 79.9K reputationPosted Jul 6, 2010, 2:11 AM EDT
dtCustInfo.TableName = "Custtable";
Amit ChoudharyRank #145 · 15.8K reputationPosted Jul 6, 2010, 2:14 AM EDT
try below code
DataTable dtCustInfo = custInfoMaster.SelectCustomerByMobileForCAF();
if(dtCustInfo!=null)
{
dtCustInfo.TableName="CustomerInformation";
dtCustInfo.writeXml("d:\\mytext.xml");
}
Please mark as answer if it helps.
Othmane Bouesga2 reputationPosted May 4, 2015, 11:27 PM EDT