Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 .NET Inside SQL Server (2005)
 LINQ And Stored Procedures

Author  Topic 

Jster
Starting Member

21 Posts

Posted - 2007-10-17 : 10:15:44
I'm using LINQ and stored procedures, but I'm having an issue on the stored procedure side. Every time I drag the stored procedure over to the dbml file it sets the return as an int, instead of a result. Below is the Code for the SPROC.


USE [master]
GO
/****** Object: StoredProcedure [dbo].[GetEntities] Script Date: 10/12/2007 08:56:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[GetEntities] @dbName nvarchar(5)
AS
DECLARE @SQL as nvarchar(200)
SET @SQL = 'USE [' + @dbName + '] SELECT bankid, BankName FROM Entities'
EXEC (@SQL)
GO



Below is the Code that is placed in the DBML File.

[Function(Name="dbo.GetEntities")]
public ISingleResult<GetEntitiesResult> GetEntities([Parameter(DbType="NVarChar(7)")] string dbName)
{
IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), dbName);
return ((ISingleResult<GetEntitiesResult>)(result.ReturnValue));
}


Any Ideas as to why I might be getting this discrepancy?

Thanks,
Josh
   

- Advertisement -