问题标签 [output-parameter]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
18957 浏览

sql-server - 通过存储过程和 c# 从 SQL Server 返回输出参数

我从 SQL Server 获取输出值时遇到了麻烦。

这是我的存储过程:

这是我的 C#:

这是我现在收到的错误:

我曾尝试将@NewQuoteNumber 从开头取出并将其放在带有 DECLARE 的 AS 之后,但这也会产生错误。

0 投票
1 回答
2121 浏览

sql-server - Accessing both stored procedure output parameters AND the result set in Entity Framework?

Is there any way of accessing both a result set and output parameters from a stored procedure added in as a function import in an Entity Framework model?

I am finding that if I set the return type to "None" such that the designer generated code ends up calling base.ExecuteFunction(...) that I can access the output parameters fine after calling the function (but of course not the result set).

Conversely if I set the return type in the designer to a collection of complex types then the designer generated code calls base.ExecuteFunction<T>(...) and the result set is returned as ObjectResult<T> but then the value property for the ObjectParameter instances is NULL rather than containing the proper value that I can see being passed back in Profiler.

I speculate the second method is perhaps calling a DataReader and not closing it. Is this a known issue? Any work arounds or alternative approaches?

Edit

My code currently looks like

0 投票
1 回答
783 浏览

vb.net - 从 VB.net 程序中的 SQL Server 2008 存储过程中获取 varchar

我试图从我的 VB.net 程序中的存储过程中获取一个字符串 (nvarchar)。当我在 SQL Studio 中运行 SP 时,它很好,但是当我尝试在程序中运行它时,我得到了错误:

这是我的SP:

这是我的vb代码:

我也尝试过使用 executeNonQuery,但这让我得到了同样的结果。任何人都可以提供任何建议吗?

谢谢

0 投票
5 回答
3878 浏览

java - 在 Java 中作为输出参数列出

我正在尝试编写一个以 List 对象作为输出参数的 Java 函数。

在此之前,我调用我声明 myList 的函数,如下所示: List myList=null; 然后我调用函数 myFunction(x,y,myList) 但是当我尝试操作 myList 时,我发现 myList 仍然为空。

我确信我的函数代码中的变量“antherList”不为空,并且我确信 subList 函数返回一个非空列表。

原因是什么,如何在 Java 函数中将 List 作为输出参数传递?非常感谢你。

0 投票
2 回答
9686 浏览

c# - 存储过程输出参数返回舍入值

我正在使用输出参数从存储过程中返回值。

存储过程中的声明是:@GrandTtl DECIMAL(19,3) OUT

SELECT查询是:

例如,选择查询返回值,4087.67然后输出参数值4088从 SQL Server 返回到 C#。

下面是调用存储过程的 C# 代码:

0 投票
3 回答
90 浏览

c++ - 如何在输出参数中使用基类

假设我有这样的代码:

今天我这样称呼它:

有没有一种更简洁的方法来避免单独的“d”对象,但又不会失去现有的类型安全性(即没有 reinterpret_cast)?

0 投票
1 回答
1197 浏览

sql - 从存储过程的 OUTPUT 参数运行查询

以下脚本旨在获取动态生成的 SQL 语句,然后运行它。该脚本将运行,但它不会返回预期的结果,而是返回动态 SQL 字符串的文本。产生的字符串是我需要运行的字符串,但它被调用了32次(奇怪的数字,我不知道为什么会这样)。有谁明白为什么这不仅仅是返回动态生成的 SQL 语句的结果集?SQL Server 2008 R2

作为记录,SQL Server 将查询解释为 32 条不同的选择语句,每条语句都在自己的行中。

返回的字符串

我的代码生成上述字符串而不是执行该 SQL:

0 投票
1 回答
1373 浏览

oracle - qt调用oracle存储过程

我正在使用QsqlQuery调用使用输入参数和两个输出参数的oracle存储过程该过程执行完美但输出参数不包含数据

任何想法感谢您的关注

0 投票
1 回答
461 浏览

c# - 在 c# 中使用 LINQ 将值从 int 作为输出参数传递给 int 变量

我有一个存储过程

我想@intGnrtdid 在使用 LINQ 时获取 int 变量的值。

0 投票
1 回答
64 浏览

excel - 创建一个接收变量的过程,然后将另一个返回到 Excel VBA 中的调用过程

我想创建允许我将变量传递给过程的功能,让它基于该变量打开一个文件,然后将文件路径返回到调用过程。我有打开文件等的代码,但是由于程序中有多个地方可以调用它,我不希望它在那里,而只是将文件路径返回到一个变量中(然后可以使用它从打开的文件中加载字段)。

加载我正在使用的文件的代码如下,我将如何将其转换为程序来执行我需要的操作?: