D
deko
I can get my DataSet to update with code in the constructor of the class
that creates the DataSet, but not using a method in that same class.
Why is this?
private DataSet projectData;
//this is the constructor of class AsaDataAccess
public AsaDataAccess()
{
projectData = new DataSet();
projectData.ReadXml(xmlFile);
DataRow dr = projectData.Tables["TableConfiguration"].NewRow();
dr["Project_ID"] = 1;
dr["ConfigurationName"] = "test";
projectData.Tables["TableConfiguration"].Rows.Add(dr);
projectData.AcceptChanges();
}
If I put this same code in a method, it will not update the Dataset, and no
error is raised
public void MyMethod()
{
DataRow dr = projectData.Tables["TableConfiguration"].NewRow();
dr["Project_ID"] = 1;
dr["ConfigurationName"] = "test";
projectData.Tables["TableConfiguration"].Rows.Add(dr);
projectData.AcceptChanges();
}
???
How can I update my DataSet using a method?
that creates the DataSet, but not using a method in that same class.
Why is this?
private DataSet projectData;
//this is the constructor of class AsaDataAccess
public AsaDataAccess()
{
projectData = new DataSet();
projectData.ReadXml(xmlFile);
DataRow dr = projectData.Tables["TableConfiguration"].NewRow();
dr["Project_ID"] = 1;
dr["ConfigurationName"] = "test";
projectData.Tables["TableConfiguration"].Rows.Add(dr);
projectData.AcceptChanges();
}
If I put this same code in a method, it will not update the Dataset, and no
error is raised
public void MyMethod()
{
DataRow dr = projectData.Tables["TableConfiguration"].NewRow();
dr["Project_ID"] = 1;
dr["ConfigurationName"] = "test";
projectData.Tables["TableConfiguration"].Rows.Add(dr);
projectData.AcceptChanges();
}
???
How can I update my DataSet using a method?