我想使用let levelSelection = UserDefaults.standard.integer(forKey: "LevelSelection")
let scene = levels[levelSelection - 1]
创建以下存储过程:
DbContext
我想通过使用
扩展CREATE PROCEDURE upGetTestID
@WOID NVARCHAR(60),
@SampleID NVARCHAR(60),
@Analyte NVARCHAR(60)
AS
SELECT TestID
FROM tblWOSampleTest
JOIN tblTest ON tblTest.TestID = tblWOSampleTest.TestID
WHERE @WOID = tblWOSampleTest.WOID
AND @SampleID = tblWOSampleTest.SampleID
AND @Analyte = tblTest.Analyte
GO
类来创建上述存储过程
DbContext
答案 0 :(得分:1)
将参数放在第一个括号中。创建存储过程,然后通过Entity Framework连接到数据库。当您想要从数据库创建上下文文件时,您将看到包含表,视图和存储过程的选项。你也会在那里看到这个存储过程。然后按照link
进行操作CREATE PROCEDURE [upGetTestID]
(@WOID nvarchar(60),
@SampleID nvarchar(60),
@Analyte nvarchar(60))
AS
BEGIN
SELECT TestID
FROM tblWOSampleTest
JOIN tblTest ON tblTest.TestID = tblWOSampleTest.TestID
WHERE @WOID = tblWOSampleTest.WOID
AND tblWOSampleTest.SampleID = @SampleID
AND tblTest.Analyte = @Analyte
END