XmlDocument xDoc = (XmlDocument)JsonConvert.DeserializeXmlNode(EntityIDList);
//string
xNode = xDoc.OuterXml;
if
(EntityIDList != null && EntityIDList
!= "")
ObjListBO.EntityIdList =
xDoc.OuterXml.Replace("<RootXML>",
"").Replace("</RootXML>", "");
Converting
the DataSet Details into XML Format of String in ASP.Net
---------------------------------------------------------------
Public
string
GetDetails(int
UserID, int
Psw)
{
DataSet
ds = new
DataSet();
SqlParameter[]
sqlParam = new
SqlParameter[2];
try
{
sqlParam[0] = new
SqlParameter("@UserID",
SqlDbType.Int)
{ Direction = ParameterDirection.Input,
Value = UserID };
sqlParam[1] = new
SqlParameter("@Psw",
SqlDbType.Int)
{ Direction = ParameterDirection.Input,
Value = Psw };
ds =
SqlHelper.ExecuteDataset(myConn,
CommandType.StoredProcedure,
"SP_GetUser",
sqlParam);
xmlDoc = new
XmlDocument();
XmlDocument
xDoc = new
XmlDocument();
if
(ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
xmlDoc.LoadXml(ds.GetXml());
XmlNodeList
xnList = xmlDoc.SelectNodes("/NewDataSet/Table");
outResultXml =
"<Root>";
foreach
(XmlNode
xn in
xnList)
{
outResultXml +=
"<User>";
outResultXml +=
xn.InnerXml;
outResultXml +=
"</User>";
}
outResultXml +=
"</Root>";
}
}
catch
(Exception
ex)
{
throw
ex;
}
return
outResultXml;
}
No comments:
Post a Comment