Reputation:
ALTER PROCEDURE dbo.uspGetOrderTrackingHeaderInfo
@ContractID varchar(9)
, @SalesRepID int
, @StatusID int
, @TypeID int
, @StartDate datetime
, @EndDate datetime
, @Identity int = null output
AS
INSERT INTO [dbo].[tblOrderTracking]
([ContractID]
,[StatusID]
,[TypeID]
,[SalesRepID]
,[StartDate]
,[EndDate])
VALUES
(@ContractID
,@StatusID
,@TypeID
,@SalesRepID
,@StartDate
,@EndDate)
SET @Identity = Scope_Identity()
Using oConn As New SqlConnection(Me.Master.Master.AdminNetConnString)
Try
With cmd
.Connection = oConn
.CommandType = CommandType.StoredProcedure
.CommandText = "dbo.uspInsertOrderTrackingInfo"
.Parameters.AddWithValue("@ContractID", Session("@OrderContractID"))
.Parameters.AddWithValue("@SalesRepID", Integer.Parse(Me.ddlSalesRep.SelectedValue.ToString()))
.Parameters.AddWithValue("@StatusID", Integer.Parse(Me.ddlStatus.SelectedValue.ToString()))
.Parameters.AddWithValue("@TypeID", Integer.Parse(Me.ddlOrderType.SelectedValue.ToString()))
.Parameters.AddWithValue("@StartDate", CDate(txtStartDate.Text.Trim))
.Parameters.AddWithValue("@EndDate", CDate(txtEndDate.Text.Trim))
.Parameters.Add("@Identity", SqlDbType.Int, ParameterDirection.Output)
End With
oConn.Open()
cmd.ExecuteNonQuery()
Session("WorkingOrderID") = cmd.Parameters("@Identity").Value
Response.Redirect("OrderOverview.aspx")
Catch ex As Exception
Me.Master.Master.HandleException(ex, True, "An error occured while attempting to save the order setup information")
Finally
If Not cmd Is Nothing Then
cmd.Dispose()
End If
End Try
End Using
Upvotes: 1
Views: 627
Reputation: 25197
You have posted code for the proc "uspGetOrderTrackingHeaderInfo" and you are calling the proc "uspInsertOrderTrackingInfo". Perhaps you have modified the wrong proc and don't have the output on the Insert one.
Upvotes: 3