我有一個像下面這樣的查詢,我如何從代碼(在C#中)執行它? 我可以在sql server中運行這個查詢。在.net(C#)運行查詢(創建過程)
create procedure addSystemError
@date Datetime,
@type nvarchar(50),
@des nvarchar(max)
as
insert into SystemError values(@date,@type,@des)
GO
create procedure loadSystemErrorCount
@startDate datetime,
@endDate datetime,
@type nvarchar(50)
as
if(@type='All')
select COUNT(*) from SystemError where date>[email protected] and date<@endDate
else
select COUNT(*) from SystemError where date>[email protected] and date<@endDate and [email protected]
Go
我想運行一個查詢,也許在這個查詢存在比存儲過程更 – user3780058
你必須把它分成兩SQL命令 - 每個'create procedure'調用一個 - 然後執行那些一個接一個。 –
如果我想創建第二個過程loadSystemErrorCount,該怎麼做? – user3780058