none
Calling 'Read' when the data reader is closed is not a valid operation. RRS feed

  • Pergunta

  • Boa Tarde,

    tenho um metodo que retorna uma procidure, está tudo correto porém quando a  minha view,

    Server Error in '/' Application.

    The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.

    E na minha index da no foreach aparece esse: Calling 'Read' when the data reader is closed is not a valid operation.


    e vou utilizar o foreach da erro no. Segue o trecho

    <

    @model System.Collections.Generic.IEnumerable<TesteMVC.Status_Fornecedor_1_Result>

    @{
        ViewBag.Title = "Index";
    }

    <h2>Status Fornecedor</h2>

    <table runat="server" >
            
        <tr><b> Nome Fornecedor </b> </tr>
        
                {
            
                @foreach (var item in Model)
                {
                    
                    <tr>    
                        <td>
                            @item.nome
                        </td>
                      
                         <td>   
                               @Html.ActionLink("Ativar Cadastro / Desativar Cadastro", "RecebeStatusFornecedor","StatusFornecedor", new {id_fornecedor= @item.id_fornecedor}, null)
                         </td>

                        <td>
                            @if(@item.id_status_fornecedor == 1)
                            {
                                <p>Ativo</p>
                            }
                             @if(@item.id_status_fornecedor == 2)
                            {
                                <p>Inativo</p>
                            }                    
                             
                        </td>
                       
                    </tr>
                 
                    
                }
        
    </table>

    />

    sexta-feira, 27 de setembro de 2013 19:25

Todas as Respostas