• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 413
  • Last Modified:

Enterprise library insert the following.

Given the following insert
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go


CREATE PROCEDURE [dbo].[sprInsertIntoTickets]
(
@ticketNumber AS nvarchar(50) = null,
@ticketType AS nvarchar(50) = null,
@ticketStatus AS nvarchar(50) = null,
@ticketSeverity AS nvarchar(50) = null,
@shortDescription AS nvarchar(1000) = null,
@externalTicket AS nvarchar(1000) = null,
@reasonMenu AS nvarchar(50) = null,
@problemNote AS ntext = null,
@solutionNote AS ntext = null,
@actionNote AS ntext = null,
@followupNote AS ntext = null,
@companiesFlag AS bit = null,
@agentCreated AS nvarchar(50) = null,
@dateCreated AS datetime = null,
@dateLastModified AS datetime = null,
@agentClosed AS nvarchar(50) = null,
@dateClosed AS datetime = null,
@agentFollowup AS nvarchar(50) = null,
@followupBy AS datetime = null,
@deletedFlag AS bit = null,
@ticketTypeOld AS nvarchar(50) = null,
@assignedTo AS varchar(50) = null,
@requestType AS varchar(50) = null,
@serviceImpact AS varchar(50) = null,
@dateTimeAssigned AS datetime = null,
@priority AS varchar(50) = null,
@dateAssigned AS datetime = null,
@trackIt AS varchar(50) = null,
@contactMethod AS varchar(50) = null,
@locationSIMs AS varchar(50) = null,
@userID AS nvarchar(50) = null,
@ticketApplicationType AS nvarchar(50) = null,
@accountID AS int = null
)
AS

INSERT INTO
  [dbo].[tbl_tickets]
(
  [TicketNumber],
  [TicketType],
  [TicketStatus],
  [TicketSeverity],
  [ShortDescription],
  [ExternalTicket],
  [ReasonMenu],
  [ProblemNote],
  [SolutionNote],
  [ActionNote],
  [FollowupNote],
  [CompaniesFlag],
  [AgentCreated],
  [DateCreated],
  [DateLastModified],
  [AgentClosed],
  [DateClosed],
  [AgentFollowup],
  [FollowupBy],
  [DeletedFlag],
  [TicketTypeOld],
  [AssignedTo],
  [RequestType],
  [ServiceImpact],
  [DateTimeAssigned],
  [Priority],
  [DateAssigned],
  [TrackIt],
  [ContactMethod],
  [LocationSIMs],
  [UserID],
  [TicketApplicationType],
  [AccountID]
)
VALUES
(
  @ticketNumber,
  @ticketType,
  @ticketStatus,
  @ticketSeverity,
  @shortDescription,
  @externalTicket,
  @reasonMenu,
  @problemNote,
  @solutionNote,
  @actionNote,
  @followupNote,
  @companiesFlag,
  @agentCreated,
  @dateCreated,
  @dateLastModified,
  @agentClosed,
  @dateClosed,
  @agentFollowup,
  @followupBy,
  @deletedFlag,
  @ticketTypeOld,
  @assignedTo,
  @requestType,
  @serviceImpact,
  @dateTimeAssigned,
  @priority,
  @dateAssigned,
  @trackIt,
  @contactMethod,
  @locationSIMs,
  @userID,
  @ticketApplicationType,
  @accountID
)

SELECT SCOPE_IDENTITY()
============================================================

public static int InsertIntoTickets()
        {
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dc = db.GetStoredProcCommand("sprInsertIntoTickets");
how can I sett this parameters in Enterprise Library.
            db.AddInParameter(dc, "intNodeId", DbType.Int32, 7553);
            db.AddInParameter(dc, "intAuditId", DbType.Int32, 5001);
            db.AddInParameter(dc, "strDesc", DbType.String, "fssfsdf");
            db.AddOutParameter(dc, "result", DbType.Int32, 100);

            db.ExecuteNonQuery(dc);
            return Convert.ToInt32(db.GetParameterValue(dc, "result"));
        }


0
mathieu_cupryk
Asked:
mathieu_cupryk
  • 4
  • 2
1 Solution
 
Anthony PerkinsCommented:
Here we go again?  Is there a question?
0
 
Anthony PerkinsCommented:
<Looking into my crystal ball>
You cannot use the ExecuteNonQuery method in order to return the resultset containing the SCOPE_IDENTITY().  You either need to return it as an OUTPUT parameter or change the method to ExecuteReader.
0
 
mathieu_cuprykAuthor Commented:
Yes this is why I am ask how to do run this in enterprise library.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Anthony PerkinsCommented:
I am afraid I have no idea.
0
 
mathieu_cuprykAuthor Commented:
delete question.
0
 
Anthony PerkinsCommented:
Please click on the "Request Attention" link and take care of it yourself.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now