protected void UpdateXMLNode(string xmlFilePath)
{
if (File.Exists(xmlFilePath))
{
DataSet ds = new DataSet();
ds.ReadXml(xmlFilePath);
string filterExpression = "NAME = '" + TextBox1.Text + "'";
DataRow[] row = ds.Tables[0].Select(filterExpression);
if (row.Length == 1)
{
row[0][0] = TextBox2.Text;
row[0][1] = TextBox3.Text;
row[0][2] = TextBox4.Text;
ds.WriteXml(xmlFilePath);
}
}
}
{
if (File.Exists(xmlFilePath))
{
DataSet ds = new DataSet();
ds.ReadXml(xmlFilePath);
string filterExpression = "NAME = '" + TextBox1.Text + "'";
DataRow[] row = ds.Tables[0].Select(filterExpression);
if (row.Length == 1)
{
row[0][0] = TextBox2.Text;
row[0][1] = TextBox3.Text;
row[0][2] = TextBox4.Text;
ds.WriteXml(xmlFilePath);
}
}
}
No comments:
Post a Comment