user1403505
user1403505

Reputation: 1005

Stored procedure execution in Entity Framework in SQL Server 2005

I am using MVC3 and Entity Framework for calling a stored procedure in SQL Server 2008. The procedure has no parameters and in the profiler I get the proc execution as

exec sp_executesql N'sp_GetDashSessionboardRoomTimeSlot', N'@p0 nvarchar(4000)', @p0=NULL

This is how I call in the c# code.

SqlParameter sa = null;
var query = from dashboardData in TBSCIDBContext.Database.SqlQuery<SessionDashboardData>("sp_GetDashSessionboardRoomTimeSlot", sa)
            select dashboardData;

This works fine. But I have changed my database to SQL Server 2005 and I need to use it

So when I call the same procedure using the same C# code the profiler returns the same exec statement but the sql gives error

Incorrect syntax near 'sp_GetDashSessionboardRoomTimeSlot'

pls help me in how to fix this problem as I need to use this stored procedure and in SQL Server 2005

Upvotes: 0

Views: 597

Answers (2)

user1403505
user1403505

Reputation: 1005

changed it to

var query = from dashboardData in TBSCIDBContext.Database.SqlQuery("sp_GetDashSessionboardRoomTimeSlot") select dashboardData;

it works

Upvotes: 1

Craig Stuntz
Craig Stuntz

Reputation: 126587

Change the ProviderManifestToken in SSDL (in your EDMX) to 2005. You probably have it set to 2008.

Upvotes: 0

Related Questions