VB.NET LINQ:在存储过程的设计器文件中自动生成代码 [英] VB.NET LINQ : Auto generated code in designer file for Stored Procedure

查看:76
本文介绍了VB.NET LINQ:在存储过程的设计器文件中自动生成代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Team,我正在使用LINQ开发桌面应用程序。我是LINQ的新手。我有一个存储过程,我在其中使用临时表并返回一个临时表。当我在DBML文件中添加此存储过程时,它不允许我选择"返回类型",但如果我在存储过程中给出一个简单的选择查询,它会给出(自动生成重新运算类型)。

我不知道如何设置这些程序的返回值。我尝试在互联网上搜索,但没有得到任何适当的解决方案。当我查看设计器时,我正在使用临时表的存储过程是重新整数,而简单的选择查询返回一行。我无法理解这个逻辑。
你能帮忙告诉我如何设置存储过程的返回类型,从临时表中返回值吗?

Hello Team,
I am developing an desktop application using LINQ. I am very new to LINQ. I have a stored proc in which I am using the Temporary table and also returning a temporary table. When I add this stored proc in the DBML file it does not allow me to select the 'Return Type' but if I give a simple select query in the stored proc it gives the (Auto-Generate Retrun Type).

I don't know how to set the return values to such procedures. I tried searching on the internet, but didnt get any proper solution to it. WHen i looked into the designer the stored proc in which i am using the temporary table is retruning an integer whereas the simple select query return an row. I fail to understand this logic.
Can you please help and tell me how to set the return type for the stored procs returning the values from the temporary table ??

推荐答案


我遇到了类似的事情。看看这是否有帮助。我实现了选项(2),得到了我想要的东西。

- 错误将这个存储过程拖到Visual Studio 2008中的Linq数据设计器表面上时错误:

I ran into something simmiliar. See if this helps. I implemented option (2), and got what I wanted.

-- ERROR WHEN dragging this stored procecure onto the Linq data designer surface in Visual Studio 2008:

- "一个或多个选定的数据库对象返回与目标数据类的架构不匹配的架构。"

-- "One or more selected database objects returns a schema that does not match the schema of the target data class."

- 周围的工作(来自http:// www .sqlservercentral.com / articles / Integration + Services / 61824 /):

-- WORK AROUND (from http://www.sqlservercentral.com/articles/Integration+Services/61824/):

- 最有可能的情况是你从临时表中选择作为源存储中的最后一个语句过程,
在这种情况下,没有元数据返回给设计者。

--Well the most likely case is that you are selecting from a temporary table as the last statement in the source stored procedure,
and in this case there is no metadata returned to the designer.

- (1)一种可能性是更改SQL命令文本,如下所示并添加斜体text:

--(1) One possibility is to change the SQL Command Text as follows and add the italicised text:

-

- 设置FMTONLY OFF

--SET FMTONLY OFF

- 设置NOCOUNT ON

--SET NOCOUNT ON

- exec myproc

--exec myproc

-

- 这会强制解析器实际运行查询以返回元数据并反转它隐含使用的SET FMTONLY ON。

--This forces the parser to actually run the query to return the metadata and reverse the SET FMTONLY ON that it implicitly uses.

-

- (2)使用表变量

--(2) Use a Table Variable instead


这篇关于VB.NET LINQ:在存储过程的设计器文件中自动生成代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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