asp.net-mvc – 当我尝试在我的asp.net mvc中导入我的存储过程时,选定的存储过程不返回任何列

前端之家收集整理的这篇文章主要介绍了asp.net-mvc – 当我尝试在我的asp.net mvc中导入我的存储过程时,选定的存储过程不返回任何列前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的sql Server 2008 r2&中有以下存储过程. asp.net mvc web应用程序: –
USE [ITSERres]
GO
/****** Object:  StoredProcedure [dbo].[AdvanceSearchSP]    Script Date: 08/04/2014 16:21:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  StoredProcedure [dbo].[AdvanceSearch2]    Script Date: 07/18/2014 10:37:47 ******/


ALTER PROCEDURE [dbo].[AdvanceSearchSP]
        -- Add the parameters for the stored procedure here

        @SearchType nvarchar(10) = null,@CustomerID bigint = null,@StringCustomerID nvarchar(50) = null,@SiteID bigint = null,@StateID bigint = null,@PrimarycustomerOnly bit = false,@RoleID int = null,@TypeID int = null,@IsManaged bit = null,@Name nvarchar(125) = null,@NameSelection nvarchar(10) = null,@Tag nvarchar(50) = null,@TagSelection nvarchar(10) =null,@ServiceTag nvarchar(100) = null,@ServiceTagSelection nvarchar(10) =null,@SerialNumber nvarchar(50) = null,@SerialNumberSelection nvarchar(10) =null,@Comment nvarchar(250) = null,@CommentSelection nvarchar(10) =null,@IP nvarchar(50) = null,@IPSelection nvarchar(10) = null,@MAC nvarchar(50) = null,@MACSelection nvarchar(10) = null
    AS
    BEGIN

        SET NOCOUNT ON;
if(@SearchType = 'name')
Begin 
        -- Insert statements for procedure here
    select t.Tag,r.RESOURCENAME,rs.DISPLAYSTATE as StateName,tt.Name as TypeName,sdo.NAME as sitename,accountdef.ORG_NAME as cusotmername,t.IsManaged as ismanaged,sysinfo.SERVICETAG,r.SERIALNO
  //code goes here...

我做了以下事情: –

>我映射了SP insdie我的.edmx文件.
>我右键单击.edmx文件,单击“模型浏览器”.
>在我的模型下,我点击功能导入.
>我右键单击SP,单击编辑.
然后当我点击“获取列信息”时,我收到以下消息: –

The selected stored procedure returns no columns

有人建议吗?
谢谢

解决方法

我也面临同样的问题.仅供参考,我的存储过程包含临时表.
谷歌搜索后,发现这个页面解决了我的问题:

http://forums.asp.net/t/2000731.aspx?EF+4+0+The+selected+stored+procedure+returns+no+columns+when+i+try+to+import+my+stored+procedure+inside+my+asp+net+mvc

建议的解决方案是在存储过程的开头添加SET FMTONLY OFF
它对我的情况非常有效.

也许你可以尝试一下.

原文链接:https://www.f2er.com/aspnet/249165.html

猜你在找的asp.Net相关文章