1
I have a routine where I update the local database with the data from another database.
I simply execute a DELETE and then a INSERT INTO tblX (SELECT * FROM tblY (tblY is a linked table)), as below.
The problem is that there is a time between the DELETE and the INSERT for the SELECT takes a long time in some cases and I wanted to minimize the possibility for the user to request registration of a table that is in the middle of this processing.
I’d like to know if there’s any mechanism for me to perform the DELETE only when the SELECT return.
conn = new OleDbConnection(Conexao.getConexaoPainelGerencialLocal());
conn.Open();
OleDbCommand cmd = new OleDbCommand(" DELETE * FROM tblClienteContato; ", conn);
cmd.ExecuteNonQuery();
cmd = new OleDbCommand(" INSERT INTO tblClienteContato " +
" SELECT * FROM tblClienteContatoVinculada;", conn);
cmd.ExecuteNonQuery();
Hello Ismael, I’m getting this message when I run Begintransaction: "Neither the Isolation level nor a Strengthening of it is supported".
– Denis
Remove the Isolationlevel. Just leave
conn.BeginTransaction();
– Ismael
It worked, but I have the problem that the user can not even make a query. I need the query to be available during this process.
– Denis
Of the different types of isolation, we have to find the ideal for this scenario. The Serializable that I informed, would allow reading in the other parts of the table, as it is not supported (need to investigate) use the isolation medium that allows the reading of the clean data - Readcommitted. If you want to read even the part that is being changed, use Readuncommitted.
– Ismael
I believe this would be the best option but I received the message "Neither the Isolation level nor a Strengthening of it is supported" for the other types of transaction, it should be Access. I ended up creating temporary tables. Thanks Ismael.
– Denis