Stored Procedure to Rest API - .Net Core Web API and SQL Server Stored Procedure

  Рет қаралды 20,542

wenhua

wenhua

Күн бұрын

Пікірлер: 22
@g89w472003
@g89w472003 3 жыл бұрын
very clear explaination
@diriya5786
@diriya5786 3 жыл бұрын
Hi, what is the method need to use the SetDatawithReturn in WebAPI?
@wenhua1708
@wenhua1708 3 жыл бұрын
In the video from 5:50 t0 6:05, the use cases of SetData and SetDataWithReturn are explained. SetData is used when the stored procedure inserts/updates a record/ records in the database with no returns while SetDataWithReturn is used when the stored procedure inserts/updates database records and returns some sort of info, e.g., with select max(ID) from Employee, that gives you the newly inserted employee ID, or anything else you need to send back that meet your business needs. Hope this helps.
@parkjeongbak6678
@parkjeongbak6678 3 жыл бұрын
Hello, i dont have problem with HttpGet but I dont know why I cant use HttpPost and HttpPut. Can you help me? I have stored procedure to update name and email in table. And I follow your httpput then db.setData(storedprocedure, parameters). And i try to run in postman the end point of localhost/api/values/updateinfo/{id} if gives me status 405. Please help me
@parkjeongbak6678
@parkjeongbak6678 3 жыл бұрын
The query is something like this UPDATE TABLE SET NAME =, EMAIL=,
@wenhua1708
@wenhua1708 3 жыл бұрын
You can set breakpoint in your put method right before try, then F10 through your code till it reaches the catch, check the error message inside the catch and the cause of the error. If you can’t get into the put method at all, make sure you select put in postman, and try again. Hope this helps.
@alfredmukonda2506
@alfredmukonda2506 3 жыл бұрын
Can i have implementation on more than 1 XML Node
@wenhua1708
@wenhua1708 3 жыл бұрын
I think you asked about the input parameter for stored procedure. The answer is yes. you may want to check with docs.microsoft.com/en-us/sql/t-sql/xml/xml-data-modification-language-xml-dml?view=sql-server-ver15 for further info.
@parkjeongbak6678
@parkjeongbak6678 3 жыл бұрын
Hello, i have a question. How can i run this web api on live? Do i need to build this as exe or just like how a website works? Sorry if this is out of topic.
@wenhua1708
@wenhua1708 3 жыл бұрын
You can follow this video kzbin.info/www/bejne/r5Tcoo2Lopxgpas to consume the API. Once you are done with the video you should be able to develop some data driven content rich websites yourself.
@besho889
@besho889 4 жыл бұрын
i get this error can you help me please "expects parameter '@id', which was not supplied"
@besho889
@besho889 4 жыл бұрын
Create PROCEDURE [dbo].[Employees_NamesS] @id int AS Select Employee_ID ,Employee_Name_IN_English From Employee where Employee_ID = @id this is my procedure
@wenhua1708
@wenhua1708 4 жыл бұрын
I believe that you define @id as input parameter of your stored procedure. If you change to @xmlparm as indicated in Dal.cs, the error should be gone. you can define a stored procedure as follows just for the sake of testing. create procedure [dbo].[uspGetProductAll3d] @xmlparm xml as BEGIN select 1 as ID, 'A Content' as Content, 'AUser' as LogonID union select 2 as ID, 'B Content' as Content, 'AUser' as LogonID union select 3 as ID, 'C Content' as Content, 'AUser' as LogonID union select 4 as ID, 'D Content' as Content, 'AUser' as LogonID union select 5 as ID, 'E Content' as Content, 'BUser' as LogonID union select 6 as ID, 'F Content' as Content, 'BUser' as LogonID union select 7 as ID, 'G Content' as Content, 'BUser' as LogonID END; Once you get through this creating API business, you can modify your SP to do whatever you want. I use xml as input for most of my SPs. It is super convenient since it can carry a great deal of structured data into the SP for you to easily consume. SQL Server makes xml manipulation easy.
@wenhua1708
@wenhua1708 4 жыл бұрын
Try this: -- --execute Employees_NamesS N'123' -- create procedure [dbo].[Employees_NamesS] @xmlparm xml as begin Select Employee_ID ,Employee_Name_IN_English From Employee where Employee_ID = @xmlparm.value('(/parameters/id)[1]','int'); end; go
@harishussain9003
@harishussain9003 3 жыл бұрын
Can you please share Stored Procedure
@wenhua1708
@wenhua1708 3 жыл бұрын
Hope you found the Stored Procedure in my reply to Besho Refaat.
@AmanRajpootTech
@AmanRajpootTech 3 жыл бұрын
Your screen viability is not good..you should zoom ur screen size
@MumtazAli-xp7jz
@MumtazAli-xp7jz 3 жыл бұрын
video is not visible :(
@wenhua1708
@wenhua1708 3 жыл бұрын
I have no problem to play the video in the States.
@sohailecp
@sohailecp 3 жыл бұрын
@@wenhua1708 he want to say that ....user can't see text
@mahmad9651
@mahmad9651 4 жыл бұрын
Kindly Share Source Code
@wenhua1708
@wenhua1708 4 жыл бұрын
github.com/cli3d/WebApi
Stored Procedures with Entity Framework Core in .NET 6 🚀
13:51
Tuna 🍣 ​⁠@patrickzeinali ​⁠@ChefRush
00:48
albert_cancook
Рет қаралды 103 МЛН
小路飞和小丑也太帅了#家庭#搞笑 #funny #小丑 #cosplay
00:13
家庭搞笑日记
Рет қаралды 17 МЛН
Calling REST endpoints from T-SQL | Data Exposed: MVP Edition
12:36
Microsoft Developer
Рет қаралды 3,8 М.
I Created The Best AI Tool Ever
9:12
ThePrimeTime
Рет қаралды 97 М.
Using Stored Procedures with Entity Framework 6 CORRECTLY In .Net 6
22:30
DevSecOps | AWS Cloud | Azure Cloud| Demo Class
41:53
ITasCode
Рет қаралды 768
ASP .NET Core Web API using SQL Server | C# tutorial for beginners
16:39
Tuna 🍣 ​⁠@patrickzeinali ​⁠@ChefRush
00:48
albert_cancook
Рет қаралды 103 МЛН