2009-06-13 9 views
0

J'ajouté ce code ci-dessous:Comment exécuter une procédure stockée dans ADO.NET Entity Framework?

public partial class Form1 : Form 
{ 
    TestAdonetEntity2Entities entityContext; 
    public Form1() 
    { 
     InitializeComponent(); 
     entityContext = new TestAdonetEntity2Entities(); 
    } 

    private void Form1_Load(object sender, EventArgs e) 
    { 
     dataGridView1.DataSource = entityContext.SelectMyCustomer(); 
    } 
} 

Mais ce code provoque une erreur:

public global::System.Data.Objects.ObjectResult<MyCustomer> SelectMyCustomer() 
{ 
    return base.ExecuteFunction<MyCustomer>("SelectMyCustomer"); 
} 

L'erreur est:

An error occurred while executing the command definition. See the inner exception for details.

Ma procédure stockée ...:

ALTER procedure [dbo].[proc_MyCustomer] 
as 
begin 
    select * from dbo.MyStuffs 
end 

Mes colonnes: CustomerID PK encre
Nom nvarchar (50)
SurName nvarchar (50)

+0

Qu'est-ce qui est dans votre InnerException ?? –

+0

{"Nom d'objet invalide 'dbo.MyStuffs'."} – Penguen

+0

J'ai rafraîchi ma question. – Penguen

Répondre

Questions connexes