简体   繁体   English

如何从F#中的SQL查询获取输出参数

[英]How to get Output parameter from SQL query in F#

I have SQL query, where I have two parameters and one output parameter (varchar). 我有SQL查询,其中有两个参数和一个输出参数(varchar)。 How I should call the procedure and get the output parameter? 我应该如何调用该过程并获取输出参数? Thanks. 谢谢。

First of all you have to connect to your db. 首先,您必须连接到数据库。 What technology are you using? 您正在使用什么技术?

In any case it could be something like that (code is written for c# & Oracle, but it will give you an idea how to solve your case): 无论如何,都可能是这样的(代码是为c#和Oracle编写的,但是它将为您提供解决方案的想法):

IDbConnection dbConnection = new OracleConnection(your_connectionstring)
var param = new OracleDyamicParameters(); 
param.Add("out_result", OracleDbType.Int64, ParameterDirection.Output);
string query = "Your_proc_Name";
await SqlMapper.QueryAsync<MyReturnClass>(dbConnection, query, param: param, commandType: CommandType.StoredProcedure);
db_res.Result = param.GetOutResult();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM