存储过程:
ALTER PROCEDURE [dbo].[TestDataSP]
AS
BEGIN
SELECT FirstName
FROM Employees
WHERE EmployeeID = 7
END
TaskTrackerDataService.cs
[WebGet]
public String GetEmployeeName()
{
TaskTracker_EDM.TaskTrackerEntities ctx = new TaskTracker_EDM.TaskTrackerEntities();
return ctx.TestDataSP().FirstOrDefault();
}
我有一个存储过程,我可以从 Web 调用它
http:localhost:2402/TaskTrackerDataService.svc/GetEmployeeName
它将返回员工姓名
<GetEmployeeName xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices">Keko88</GetEmployeeName>
当我尝试从我的 WPF 项目中调用存储过程时
TaskTrackerDataService.TaskTrackerEntities ctxDSvc = new TaskTrackerDataService.TaskTrackerEntities(new Uri("http:localhost:2402/TaskTrackerDataService.svc"));
String emps1 = ctxDSvc.Execute<String>(new Uri("http:localhost:2402/TaskTrackerDataService.svc/GetEmployeeName")).ToString();
Console.WriteLine(string.Format("ID: {0} ==== ==== ==== ", emps1));
它总是返回
"System.Data.Services.Client.QueryOperationResponse`1[System.String]"
任何帮助,请