A customer wrote in today with an issue he was having in chapter 5 (More LINQ To SQL) of the LINQ course. The sample application calls two stored procedures (AddOrder and AddOrderDetail) in the Northwind database. These stored procedures are not created when you install Northwind. I wrote them.
Unfortunately, I neglected to include instructions on how to create these and so when you run the Transactions sample in chapter 5, you get an error. I apologize for this. Attached to this post is the code to create these stored procedures. The file also includes code to create four other stored procedures that are used in chapter 4. That chapter includes instructions on how to create them, but they are in the file anyway.
In case you have difficulty downloading the file, here is the code for the AddOrder and AddOrderDetails stored procedures. Again, I apologize for the confusion and my omission.
USE Northwind
GO
CREATE PROCEDURE [dbo].[AddOrder]
(
@CustomerID nchar(5),
@EmployeeID int,
@OrderDate datetime,
@RequiredDate datetime,
@ShipVia int,
@Freight money,
@ShipName nvarchar(40),
@ShipAddress nvarchar(60),
@ShipCity nvarchar(15),
@ShipRegion nvarchar(15),
@ShipPostalCode nvarchar(10),
@ShipCountry nvarchar(15)
)
AS
INSERT INTO [dbo].[Orders] ([CustomerID], [EmployeeID],
[OrderDate], [RequiredDate], [ShipVia],
[Freight], [ShipName], [ShipAddress], [ShipCity],
[ShipRegion], [ShipPostalCode], [ShipCountry])
VALUES (@CustomerID, @EmployeeID, @OrderDate,
@RequiredDate, @ShipVia, @Freight,
@ShipName, @ShipAddress, @ShipCity, @ShipRegion,
@ShipPostalCode, @ShipCountry);
RETURN SCOPE_IDENTITY()
GO
CREATE PROCEDURE [dbo].[AddOrderDetail]
(
@OrderID int,
@ProductID int,
@UnitPrice money,
@Quantity smallint,
@Discount real
)
AS
/* SET NOCOUNT ON */
INSERT INTO [dbo].[Order Details] ([OrderID], [ProductID],
[UnitPrice], [Quantity], [Discount])
VALUES (@OrderID, @ProductID, @UnitPrice, @Quantity, @Discount);
GO