Jagjit Saini

Jagjit Saini

  • NA
  • 166
  • 0

Error : does not exist in current context

Sep 22 2011 1:53 AM
Hi


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;

public partial class XML : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        String[] FileContent = File.ReadAllLines(@"C:\Temp\abc.csv");
        String XMLNS = "";
        XElement Inv = new XElement("Invoice",
        from items in FileContent
        let fields = items.Split(',')
        select new XElement("Item",
        new XElement("ID", fields[0]),
        new XElement("Name", fields[1]),
        new XElement("Price", fields[2]),
        )
        );
        File.WriteAllText(@"C:\Temp\vba.xml", XMLNS + Inv.ToString());
    }
}

Error : File does not exist in this current context.


Thanks

Answers (1)