C# Winforms Npgsql 3.0.5 "An operation already in progress" error when trying to run multiple commands inside same connection
<p>I'm trying to run the following snippet in C# Winforms. This piece of code is working well with pgsql 2.2.6 adapter. What correction can be made in order to work fine with pgsql3.0.5 adapter? Thanks.</p>

<pre><code>NpgsqlConnection conn = new NpgsqlConnection(MainForm2.MyConString);
        {
            conn.Open();
            using (NpgsqlCommand cmd = new NpgsqlCommand("SELECT rfid,name,sc_id from passenger ORDER by name", conn))
            {
                NpgsqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    var obj = new PassengerClass
                    {
                        RFID = dr.GetString(0),
                        Name = dr.GetString(1),
                        sc_id = dr.GetInt32(2)
                    };
                    s = dr.GetString(0);
                    try { ret.Add(s, obj); }
                    catch (Exception ex) { SM.Debug("Fail to add RFID Name in hash RFID:" + s + ex.ToString()); }
                }
            }
            MainForm2.PassHash = ret;
            try
            {
                using (NpgsqlCommand cmd = new NpgsqlCommand(string.Format("UPDATE place set useridx ={0} where useridx=0", MainForm2.userIDX), conn))
                    cmd.ExecuteNonQuery();

                using (NpgsqlCommand cmd = new NpgsqlCommand(string.Format("UPDATE zonename set useridx ={0} where useridx=0", MainForm2.userIDX), conn))
                    cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                SM.Debug("Error on update users IDX for place and zone with value 0 :" + ex.ToString());
            }
</code></pre>

<p>So, at the second command statement it gives me the following error: </p>

<blockquote>
  <p>A first chance exception of type 'System.InvalidOperationException'
  occurred in Npgsql.dll</p>
  
  <p>Additional information: An operation is already in progress.</p>
</blockquote>

<p><a href="https://i.stack.imgur.com/jbaDI.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/jbaDI.jpg" alt="enter image description here"></a></p>

<p><strong>EDIT</strong> Additional info:
<a href="https://i.stack.imgur.com/wG2Mo.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/wG2Mo.jpg" alt="enter image description here"></a></p>