public MyDataTable() { if (File.Exists(Application.StartupPath + "\\Data.xml")) { StoreDataTable = MyDataSource.Read(); } else { StoreDataTable = new DataTable("DiscuzData"); DataColumn dataColumn = new DataColumn("TopicID", typeof(int)); StoreDataTable.Columns.Add(dataColumn); StoreDataTable.Columns.Add("HitFloorIDs", typeof(string)); StoreDataTable.Columns.Add("CurrentFloor", typeof(string)); StoreDataTable.Columns.Add("Content", typeof(string)); StoreDataTable.Columns.Add("Status", typeof(string)); StoreDataTable.PrimaryKey = new[] { dataColumn }; Save(); } }
public void Save() { MyDataSource.Save(StoreDataTable); }