例如我有这个存储过程
Create Procedure sampleProcedure
AS
BEGIN
Select EmpID, Name, Address, PhoneNumber From EmpTable
END
现在在我的应用程序中我将如何执行此操作:例如,用户检查了 checkBox1,然后上面的查询将是ORDER BY EmpID
else 如果检查了 checkBox2,那么查询将是ORDER BY Name
. 我必须创建两个程序吗?
Create Procedure sampleProcedure1
AS
BEGIN
Select EmpID, Name, Address, PhoneNumber From EmpTable Order By EmpID
END
Create Procedure sampleProcedure2
AS
BEGIN
Select EmpID, Name, Address, PhoneNumber From EmpTable Order By Name
END
如果 checkbox1 被选中,则 sampleProcedure1 将被执行,否则如果 checkbox2 被选中,则 sampleProcedure2 将被执行?