|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
newbie: DataSet update questionthat 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? Hi deko
I don't think so.For updating dataset is not neccessary to put your code in the constructor.Call MyMethod again, if it is working in constructor, then it must work in the method. Best Regards, A.Hadi > I don't think so.For updating dataset is not neccessary to put your Thanks for the reply. It's strange behavior and I don't understand it. I > code in the constructor.Call MyMethod again, if it is working in > constructor, then it must work in the method. was researching constraints, but that does not appear to be it. The only other thing I can think of is that the modal form that calls the method is hitting some kind of lock. |
|||||||||||||||||||||||