发布网友 发布时间:2022-05-01 18:32
共2个回答
懂视网 时间:2022-04-11 03:33
NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N‘[dbo].[CreateAuthor]‘) AND type in (N‘P‘, N‘PC‘)) BEGIN EXEC dbo.sp_executesql @statement = N‘ CREATE PROCEDURE [dbo].[CreateAuthor] @FirstName Varchar(50), @LastName Varchar(50), @Address Varchar(100) AS INSERT INTO dbo.Authors( [FirstName], [LastName], [Address] ) VALUES (@FirstName, @LastName, @Address) ‘using (var context = new BookStore()) { int affectedRows = context.Database.ExecuteSqlCommand("CreateAuthor @p0, @p1, @p2", parameters: new[] { "Mark", "Cuban", "23 Tsawassen Blvd." }); }
9.用ExecuteSqlCommand执行存储过程
标签:cts exist 执行存储过程 te pro sys data span object_id fir
热心网友 时间:2022-04-11 00:41
(一) 使用EXECUTE命令运行命令字符串 可简写为:EXEC (二) 使用系统存储过程sp_executesql运行Unicode命令字符串