LINQ to SQL -- 无法修改存储过程的返回类型 [英] LINQ to SQL -- Can't modify return type of stored procedure

查看:39
本文介绍了LINQ to SQL -- 无法修改存储过程的返回类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将特定的存储过程拖入 VS 2008 dbml 设计器时,它显示的返回类型设置为无",并且它是只读的,因此我无法更改它.设计器代码将其显示为返回一个 int,如果我手动更改它,它只会在下一次构建时被撤消.

When I drag a particular stored procedure into the VS 2008 dbml designer, it shows up with Return Type set to "none", and it's read only so I can't change it. The designer code shows it as returning an int, and if I change that manually, it just gets undone on the next build.

但是使用另一个(几乎相同的)存储过程,我可以很好地更改返回类型(从自动生成类型"到我想要的类型.)

But with another (nearly identical) stored procedure, I can change the return type just fine (from "Auto Generated Type" to what I want.)

我在两台不同的机器上遇到了这个问题.知道发生了什么吗?

I've run into this problem on two separate machines. Any idea what's going on?

这是有效的存储过程:

USE [studio]
GO
/****** Object:  StoredProcedure [dbo].[GetCourseAnnouncements]    Script Date: 05/29/2009 09:44:51 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
CREATE PROCEDURE [dbo].[GetCourseAnnouncements]
    @course int
AS
SELECT * FROM Announcements WHERE Announcements.course = @course
RETURN

而这个没有:

USE [studio]
GO
/****** Object:  StoredProcedure [dbo].[GetCourseAssignments]    Script Date: 05/29/2009 09:45:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
CREATE PROCEDURE [dbo].[GetCourseAssignments]
    @course int
AS
SELECT * FROM Assignments WHERE Assignments.course = @course ORDER BY date_due ASC
RETURN

推荐答案

好的,我发现了问题......有点.我已经更改了Assignments"表的名称并忘记更新存储过程,因此 DBML 设计人员感到困惑.但是即使我更新了存储过程,从 DBML 设计器中删除它并阅读它,它也不起作用!

Okay, I found the problem... kind of. I had changed the name of the table "Assignments" and forgot to update the stored procudure, so the DBML designer was confused. BUT even after I updated the stored procedure, deleted it from the DBML designer and readded it, it wasn't working!

这几乎与此处讨论的问题相同:http://forums.asp.net/t/1231821.aspx.

This is nearly the same problem discussed here: http://forums.asp.net/t/1231821.aspx.

只有当我从数据库中删除存储过程并重新创建它时,它才起作用,然后从 DBML 设计器中删除它,重新编译,重新启动 Visual Studio,然后再次添加它.这是我第二次遇到 Visual Studio DBML 设计器的刷新"问题...

It only worked when I deleted the stored procedure from the database and recreated it, and deleted it from the DBML designer, recompiled, restarted Visual Studio, and added it again. This is the second time I've run into "refresh" problems with the Visual Studio DBML designer...

这篇关于LINQ to SQL -- 无法修改存储过程的返回类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆