public void GenerateXmlTestDataFromExistingDatabase() { var adapter = new Data.Access2003DataSetTableAdapters.UsersTableAdapter(); adapter.Connection = new OleDbConnection(Properties.Settings.Default.Access2003ConnectionString); var dt = new Access2003DataSet.UsersDataTable(); adapter.Fill(dt); dt.WriteXml(@"..\..\Data\Access2003TestData.xml"); var adapter2 = new Data.Access2007DataSetTableAdapters.UsersTableAdapter(); adapter2.Connection = new OleDbConnection(Properties.Settings.Default.Access2003ConnectionString); var dt2 = new Access2007DataSet.UsersDataTable(); adapter2.Fill(dt2); dt2.WriteXml(@"..\..\Data\Access2007TestData.xml"); }
public void Reset() { if (this._dbType == AccessDatabaseType.Access2003 || this._dbType == AccessDatabaseType.Access2002) { var adapter = new Data.Access2003DataSetTableAdapters.UsersTableAdapter(); adapter.Connection = _connection; // Delete any existing records adapter.DeleteAll(); // Auto reset numbers by compacting Access // MAKE SURE to first delete all data ResetAutoNumbers(_connectionString, "tempDb.mdb", this._dbPath); // Load clean data var dt = new Access2003DataSet.UsersDataTable(); dt.ReadXml(this._xmlData); adapter.Update(dt); } else { var adapter = new Data.Access2007DataSetTableAdapters.UsersTableAdapter(); adapter.Connection = _connection; // Delete any existing records adapter.DeleteAll(); // Auto reset numbers by compacting Access // MAKE SURE to first delete all data ResetAutoNumbers(_connectionString, "tempDb.accdb", this._dbPath); // Load clean data var dt = new Access2007DataSet.UsersDataTable(); dt.ReadXml(this._xmlData); adapter.Update(dt); } }