<cat> <name> "Categories"</name> <link> "link"</link> </cat>
The Categories and link values should be added from the database.
I have tried everything but I cannot get it to work.
DO I have to create a XML file in ASP to do this?
These values are in the same table but there are other columns in the table as well.
My code looks something like this:
SqlCommand sqlcmd = new SqlCommand(); //sqlcmd.CommandText = "Select * from Categories"; DataSet ds = new DataSet(); System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter("Select * from Categories", "Data Source=something;Initial Catalog=My Database;Integrated Security=True"); da.Fill(ds); int rows; rows = ds.Tables[0].Rows.Count; int i; for (i = 0; i <= rows - 1; i++) { string Categories = ds.Tables[0].Rows[i].ItemArray[0].ToString(); string address = "[url="https://www.spendless.net.au/%22;"]https://example.com/";[/url] string link = address + ds.Tables[0].Rows[i].ItemArray[1].ToString(); } // ds.WriteXml(@"c:\output.xml", XmlWriteMode.WriteSchema);
I should create a XML filed based on these requirements and display it on another page.
I also need to add a header to the top of the XMLfile like
<name = some name date = today's date time = current time>
How can I do this??
Can someone please give me a detailed solution to this problem ASAP.
Thank you
Edited by Roger, 18 September 2012 - 07:38 AM.
removed formatting, added code tags