Base solution for your next web application
Open Closed

Cannot execute stored procedure #5016


User avatar
0
squaresunion created

Hello something that is really killing me

trying to execute a stored proc (Angular 5 .Net Core) g.Database.ExecuteSqlCommand("EXEC sp_GetNextBusinessId"); But is is always returning -1. Tried to use an output parameter, always returning value 0; Can somebody help. Please.

Regards

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

2 Answer(s)
  • User Avatar
    0
    squaresunion created

    Ok found the proper way to do it.

    SqlParameter param = new SqlParameter() { ParameterName = "@MyID", SqlDbType = SqlDbType.BigInt, Direction = ParameterDirection.Output }; var t = g.Database.ExecuteSqlCommand("EXEC sp_GetNextBusinessId @MyID OUT", param);

    this works fine

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    alper created
    Support Team
    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)