Hi Guys,
I need help on my first ASP.NET Core MVC Using ADO.NET, I can't pass the error message store procedure not found
A Simple Helpdesk Ticket System that collects info from the client and sends an email to tech support.
Here it is the whole project which is available to the public --> Simple Helpdesk Ticket System
github.com/netstair/NetstairHelpdeskV5_ADONET
Thanks
J.Saiz
Amit MohantyPosted Nov 6, 2023, 12:42 PM
Try like this once:
Jose SaizPosted Mar 1, 2024, 2:04 PM
Is there a way that I can have my connection string either on the appsettings.json and retrieve it from the appsettings.json instead of having on every model datalayer as it reads on my class? Please provide sample code how to retrieve from the appsettings.json and use it my datalayer.
Thanks
Jose SaizPosted Nov 7, 2023, 12:09 PM
Thank you much Amit Mohanty, finally It worked, I was very fustrated with .NET Core that I was giving up, I've been developing ASP.NET WebForm for a while now and I wanted to convert some of my project to .NET Core I tried converting straight from Microsoft suggestion that did not work, then rewrite to .NET Core 2.0 some project worked and now trying to be at least close to the game with .NET Core 5 even though Microsoft is not supporting and found this wall that stopped me but thanks to you I can continue and try to make it happen, my next challance will be the Entity Framework which I believe is better using than ADO.NET, I am afraid to ask why this didnot work string sqlQuery = "dbo.spGetTicketData 0"; it worked like a charm in ASP.NET Webform.
Thank you for all your help.
Jignesh KumarPosted Nov 7, 2023, 6:15 AM
Hello Jose Siaz,
Your store procedure expecting @TicketId as parameter, You need to pass parameter in your code,
Please have a look at below code
Jose SaizPosted Nov 6, 2023, 1:53 PM
The whole project along with database, tables and store proc are part of the public github source https://github.com/netstair/NetstairHelpdeskV5_ADONET/blob/master/HelpDeskDb_Database_Script.sql
Thanks
Jignesh KumarPosted Nov 6, 2023, 12:37 PM
Could you please share your store procedure ? either your store procedure has parameter which we need to pass from back end but for method GetAllTickets() should not have any parameter as per name it should return all tickets.
Jose SaizPosted Nov 6, 2023, 12:06 PM
Thank you Jignesh Kumar for the reply, but I still get the same error message with both solution provided
Suggested using exec 'dbo.spGetTicketData'
SqlException: Could not find stored procedure 'exec 'dbo.spGetTicketData' '.
Suggested using "spGetTicketData"'
SqlException: Procedure or function 'spGetTicketData' expects parameter '@TicketId', which was not supplied.
Or when using "spGetTicketData 0"'
SqlException: Could not find stored procedure 'spGetTicketData 0'.
I am not sure the MS-SQL environment has anything to do with, I am using MS-SQL 2008 R2, meanwhile If I drop the .NET core to version 2.0 it works, I understand Core 2.0 is old and no longer supported, that is why I am using .NET Core 5.0
Thanks
Jignesh KumarPosted Nov 6, 2023, 4:25 AM
Hello,
Are you getting error in GetAllTickets() method. please do change in this line only,
Still you are getting error, then please run this store procedure in SQL Query window using