I have a below query in C# getting data from oracle
using (OracleConnection con = new OracleConnection(ConnectionString))
{
con.Open();
OracleCommand command = new OracleCommand("select firstname,secondname,lastname,
age,gender from Members", con))
OracleDataReader rdr = command.ExecuteReader();
while(rdr.Read())
{
.....
}
}
Now from this query i need to create an xml as below. Please help me to know the best way to achieve the same
<Root>
<Member>
<Name>
<firstname>firstname1<firstname>
<secondname>secondname1<secondname>
<lastname>lastname<lastname>
</Name>
<age>45</age>
<gender>M</gender>
</Member>
<Member>
<Name>
<firstname>firstname2<firstname>
<secondname>secondname2<secondname>
<lastname>lastname2<lastname>
</Name>
<age>25</age>
<gender>F</gender>
</Member>
</Root>