public void SyncToDatabase(DsnConnection dsn) { if (dsn != null) { switch (dsn.DbMode) { case DsnConnection.ConnectionMode.Odbc: case DsnConnection.ConnectionMode.MySqlNative: // cannot truncate foreign keyed tables. //dsn.ExecuteNonQuery( "truncate " + Prefix + XTableName ); dsn.ExecuteNonQuery("delete from " + Prefix + XTableName); // want to reset the keys though... so can truncate after it's empty? dsn.ExecuteNonQuery("ALTER TABLE " + Prefix + XTableName + " AUTO_INCREMENT = 1"); break; case DsnConnection.ConnectionMode.Sqlite: dsn.ExecuteNonQuery("delete from " + Prefix + XTableName); dsn.KindExecuteNonQuery("update sqlite_sequence set seq = 1 where name='" + Prefix + XTableName + "'"); break; default: dsn.ExecuteNonQuery("delete from " + Prefix + XTableName); break; } DsnSQLUtil.InsertAllRows(dsn, this); } filling = false; }
public static void ExecuteNonQuery(string s) { _dsn.ExecuteNonQuery(s); }