HELLO
when ever im trying to execute this, im getting an error as object reference not set to an instance of an object
private void button2_Click(o bject sender, EventArgs e)
{
try
{
button1.Enabled = false;
XmlDocument doc = new XmlDocument();
doc.Load("C:\\D ocuments and Settings\\srakk li\\Desktop\\sa mple.xml");
XmlNodeList xnl = doc.SelectNodes ("//info");
foreach (XmlNode node in xnl)
{
if (node.Attribute s["salary"].Value == null)
{
Console.WriteLi ne("no col");
}
else
{
node.Attributes["salary"].Value = (Int32.Parse(no de.Attributes["salary"].Value) + 100.ToString()) ;
}
}
doc.Save("C:\\D ocuments and Settings\\srakk li\\Desktop\\sa mple.xml");
}
catch (SqlException ee)
{
Console.WriteLi ne(ee);
Console.ReadLin e();
}
when ever im trying to execute this, im getting an error as object reference not set to an instance of an object
private void button2_Click(o bject sender, EventArgs e)
{
try
{
button1.Enabled = false;
XmlDocument doc = new XmlDocument();
doc.Load("C:\\D ocuments and Settings\\srakk li\\Desktop\\sa mple.xml");
XmlNodeList xnl = doc.SelectNodes ("//info");
foreach (XmlNode node in xnl)
{
if (node.Attribute s["salary"].Value == null)
{
Console.WriteLi ne("no col");
}
else
{
node.Attributes["salary"].Value = (Int32.Parse(no de.Attributes["salary"].Value) + 100.ToString()) ;
}
}
doc.Save("C:\\D ocuments and Settings\\srakk li\\Desktop\\sa mple.xml");
}
catch (SqlException ee)
{
Console.WriteLi ne(ee);
Console.ReadLin e();
}
Comment