Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server WCF服务-从实体模型中的存储过程返回输出参数_Sql Server_Wcf_Stored Procedures_Output Parameter - Fatal编程技术网

Sql server WCF服务-从实体模型中的存储过程返回输出参数

Sql server WCF服务-从实体模型中的存储过程返回输出参数,sql-server,wcf,stored-procedures,output-parameter,Sql Server,Wcf,Stored Procedures,Output Parameter,我有一个用于身份验证、获取登录名和密码并返回字符串的存储过程。我想从我的WCF数据服务(使用实体模型和函数导入)调用存储过程(sql server 2005),并返回输出参数(字符串)作为结果 我正在使用函数导入映射存储过程。我应该如何进行 终于找到答案了!!我们必须使用输出参数,将其作为被调用存储过程的参数,最后通过类型转换,我们可以使用该值。(我的返回格式是JSON,但对XML格式同样有效) 接口: [经营合同] [WebInvoke(Method=“GET”, BodyStyle=WebM

我有一个用于身份验证、获取登录名和密码并返回字符串的存储过程。我想从我的WCF数据服务(使用实体模型和函数导入)调用存储过程(sql server 2005),并返回输出参数(字符串)作为结果


我正在使用函数导入映射存储过程。我应该如何进行

终于找到答案了!!我们必须使用输出参数,将其作为被调用存储过程的参数,最后通过类型转换,我们可以使用该值。(我的返回格式是JSON,但对XML格式同样有效) 接口: [经营合同] [WebInvoke(Method=“GET”, BodyStyle=WebMessageBodyStyle.Wrapped, ResponseFormat=WebMessageFormat.Json, RequestFormat=WebMessageFormat.Json, UriTemplate=“authenticate/{login}/{pwd}”)]

Implementation: 
public string authenticate(string login, string pwd)
{
SteelcaseMigrationEntities entities = new SteelcaseMigrationEntities();

System.Data.Objects.ObjectParameter output =  
new     System.Data.Objects.ObjectParameter("out", typeof(string));
entities.authenticate_android(login, pwd, output);
//Console.Write(output.Value)
string result = (string)output.Value;
return result;
}