J
James Page
Hi all
I've a sproc:
ALTER PROCEDURE dbo.insertOrder
@orderDate As dateTime,
@customerId As UniqueIdentifier,
@subTotal As money,
@delivery As money,
@total As money,
@orderId int OUTPUT
AS
INSERT INTO dbo.orders (customerId, orderDate, subTotal, delivery,
total)
VALUES (@customerId, @orderDate, @subTotal, @delivery, @total)
SELECT SCOPE_IDENTITY() AS orderId
I can access this via linq in the usual way but in the helper class i've
created i want to insert the above records and then retrieve the id of that
inserted record row (orderId) for use later on in the class.
The linq I have is:
db.Insertorder(orderDate, UserId, subTotal, delivery, total)
but this returns an error (it wants a value for orderId).
The required parameters (orderDate etc) have been set elsewhere.
What am I missing here. My objective is to insert a new record, retrieve the
orderId, store the orderId in a public variable and reuse it later on in the
class.
Any pointers?
VB.NET ASP NET 3.5 SQL 2008
I've a sproc:
ALTER PROCEDURE dbo.insertOrder
@orderDate As dateTime,
@customerId As UniqueIdentifier,
@subTotal As money,
@delivery As money,
@total As money,
@orderId int OUTPUT
AS
INSERT INTO dbo.orders (customerId, orderDate, subTotal, delivery,
total)
VALUES (@customerId, @orderDate, @subTotal, @delivery, @total)
SELECT SCOPE_IDENTITY() AS orderId
I can access this via linq in the usual way but in the helper class i've
created i want to insert the above records and then retrieve the id of that
inserted record row (orderId) for use later on in the class.
The linq I have is:
db.Insertorder(orderDate, UserId, subTotal, delivery, total)
but this returns an error (it wants a value for orderId).
The required parameters (orderDate etc) have been set elsewhere.
What am I missing here. My objective is to insert a new record, retrieve the
orderId, store the orderId in a public variable and reuse it later on in the
class.
Any pointers?
VB.NET ASP NET 3.5 SQL 2008