Database Reference
In-Depth Information
as
begin
delete from Chapter10.Product where ProductId = @ProductId
end
go
create procedure [chapter10].[InsertDVD]
(@Title varchar(50), @Rating varchar(50))
as
begin
insert into Chapter10.Product (Title, Rating, ProductType) values
(@Title, @Rating, 'DVD')
select SCOPE_IDENTITY() as ProductId
end
go
create procedure [chapter10].[DeleteDVD]
(@ProductId int)
as
begin
delete from Chapter10.Product where ProductId = @ProductId
end
go
create procedure [chapter10].[UpdateDVD]
(@Title varchar(50), @Rating varchar(50), @ProductId int)
as
begin
update Chapter10.Product set Title = @Title, Rating = @Rating
where ProductId = @ProductId
end
2.
Right-click the design surface, and select Update Model from Database. Select the newly
created stored procedures, and click Finish to add them to the model.
3.
Right-click the Book entity and select Stored Procedure Mapping. Map the InsertBook ,
UpdateBook , and DeleteBook stored procedures to the corresponding actions for the
entity. Map the Result Column Binding for the Insert action to the ProductId property
(see Figure 10-15 ).
Search WWH ::




Custom Search