Estoy ejecutando lo siguiente y me da este error: Ya hay un DataReader asociado a este command, debe cerrarlo primero. Me podéis echar una mano? no se lo que estoy haciendo mal ni se como cerrar el DataReader.
Código vb.net:
Ver original
Protected Sub eliminarDatos(ByRef ident As String) Dim conn As New SqlConnection(WebConfigurationManager.ConnectionStrings("conexion").ConnectionString) Dim comm1 As SqlCommand = New SqlCommand("DELETE FROM dbo.temp_datosGuardados WHERE id_identificador = @id_identificador", conn) Dim reader1 As SqlDataReader Dim mytrans As SqlTransaction Try With comm1 .CommandType = CommandType.Text .Parameters.AddWithValue("id_identificador", ident) End With Using conn conn.Open() mytrans = conn.BeginTransaction() Try With comm1 .Transaction = mytrans reader1 = .ExecuteReader() While reader1.Read() .ExecuteNonQuery() .Dispose() End While mytrans.Commit() End With Catch ex As Exception mytrans.Rollback() 'mensaje("Error en BD" & Chr(13) & Chr(13) & ex.Message) End Try End Using Catch ex As Exception 'mensaje("Error en BD" & Chr(13) & Chr(13) & ex.Message) Finally conn.Dispose() End Try End Sub