Search Posts

Author: MathLover

Preventing deadlock

I have the following transaction code: using(MySqlConnection connection = new MySqlConnection(connectionString)) { connection.Open(); using(MySqlTransaction transaction = connection.BeginTransaction()) { using(MySqlCommand cmd = new MySqlCommand()) { cmd.CommandTimeout = 0; … … cmd.Connection = connection; cmd.Transaction = transaction; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = sp; object retVal = cmd.ExecuteScalar(); transaction.Commit(); return retVal; } } } It is running a stored procedure, whose code is shown below: CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_load`(IN param_first_sighting BIGINT(20), IN param_interval INT(11)) BEGIN DECLARE out_param INT […]