public static string ConvertToXML(DataSet ds)
{
int rows = ds.Tables[0].Rows.Count;
int columns = ds.Tables[0].Columns.Count;
int i = 0;
string result = "";
result = "<Rows>";
for (i = 0; i < rows; i++)
{
result = result + "<Row>";
for (int j = 0; j < columns; j++)
{
result = result + "<Column>" + ds.Tables[0].Rows[i][j].ToString() + "</Column>";
}
result = result + "</Row>";
}
result = result + "</Rows>";
return result;
}
{
int rows = ds.Tables[0].Rows.Count;
int columns = ds.Tables[0].Columns.Count;
int i = 0;
string result = "";
result = "<Rows>";
for (i = 0; i < rows; i++)
{
result = result + "<Row>";
for (int j = 0; j < columns; j++)
{
result = result + "<Column>" + ds.Tables[0].Rows[i][j].ToString() + "</Column>";
}
result = result + "</Row>";
}
result = result + "</Rows>";
return result;
}
No comments:
Post a Comment