Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Entity Framework Core 3.1 Return value (int) from stored procedure

int? quantity = 0;
var ticketParam = new SqlParameter("Ticket", ticket);
var referenceParam = new SqlParameter("Reference", reference);
var quantityParam = new SqlParameter("Quantity") { Direction = ParameterDirection.Output };
try
{
    await _context.Database.ExecuteSqlRawAsync("EXEC Production.Select_TicketQuantity @Ticket, @Reference, @Quantity output", new[] { ticketParam, referenceParam, quantityParam });
    quantity = Convert.ToInt32(quantityParam.Value);
}
catch (Exception ex)
{
    _logger.LogError($"{ex}");
    return RedirectToPage("Index");
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: Customize yup number 
Csharp :: list search c# 
Csharp :: sleep in c# 
Csharp :: 2d list c# 
Csharp :: C# monogodb 
Csharp :: c# create tasks and wait all 
Csharp :: lcm of list of number 
Csharp :: checking if character is a digit or not in c# 
Csharp :: c# print decimal with zero at the end 
Csharp :: font dialog c# code 
Csharp :: find how many digits a number has 
Csharp :: c# object list attribute to string 
Csharp :: .net core partial view with model 
Csharp :: else if c# 
Csharp :: c# calculate sum of list 
Csharp :: how to set foreground from code wpf 
Csharp :: c# is odd number 
Csharp :: how get data from json in c# 
Csharp :: c# .net 3.5 post json httpclient 
Csharp :: c# add time to datetime 
Csharp :: how to make a string in c# 
Csharp :: static c# 
Csharp :: create new object from generic c# 
Csharp :: c# add 2 arrays 
Csharp :: unity vector3 to array 
Csharp :: autofac .net core 6 
Csharp :: string substring c# before 
Csharp :: how to generate a random number in c# 
Csharp :: c# get list object type of generic list 
Csharp :: how to keep rigidbody2D upright unity 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =