我使用的是EF 5,这是我的SP
USE [MYDatabase] GO
SET ANSI_NULLS ON GO
SET QUOTED_IDENTIFIER ON GO
ALTER PROCEDURE [dbo].[SP_FirstAttend] @serviceStart date, @serviceEnd date AS
BEGIN
SET NOCOUNT OFF
SET FMTONLY OFF
--IF (1=0)
--BEGIN
--SET FMTONLY ON
BEGIN
DROP TABLE #temp1
CREATE TABLE #temp1 (id int, sid int, npi int, fiscal int, serviceStart date, serviceEnd date, fcode varchar(10), tid int, StudName varchar(200), TherName varchar (200))
INSERT INTO #temp1
SELECT ID,
mand.SID,
mand.NPI,
FiscalYear,
ServiceStart,
ServiceEnd,
FundingCode,
ther.TID,
RTRIM(stud.StudentLastName) + ' ' + RTRIM(stud.StudentFirstName),
RTRIM(ther.LastName) + ' ' + RTRIM(ther.FirstName)
FROM MandateMaster AS mand
JOIN TherapistMaster AS ther ON ther.NPI = mand.NPI
JOIN StudentMaster AS stud ON stud.SID = mand.SID
SELECT *,
(SELECT top(1) sid
FROM SessionDetail
WHERE SID = tb1.sid
AND TID = tb1.tid) AS val1
FROM #temp1 AS tb1
WHERE ServiceStart >= @serviceStart
AND ServiceStart <= @serviceEnd;
END
-- END
END
它还在给我“存储过程不返回任何列”。
我在某处读到了设置 综合安全=真;在web.config上的连接字符串中,但仍然无效。
我一直在努力为此找到解决方案,但不断收到相同的消息。请让我知道该怎么做。
感谢。
答案 0 :(得分:0)
您没有得到任何结果,因为此条件IF (1=0)
始终返回false
,那么您的select
语句永远不会被命中。
只需删除此IF (1=0)
,您的存储过程就会返回一些数据。