Quote:
Can you check my stored procedure once ?
The answer to that question is "No. We can't" - for the reasons that OriginalGriff has given you above
You also state that you "already done this". So I assume that you ...
1. put a breakpoint on the line
db.Update( category.Category_Code, category.Category_Name, category.About_Category, category.Parent_Category_Id, category.Is_Enable, category.Is_Active, category.Is_Block,category.Category_Id);
2. Hovered over, used watch or whichever method you prefer to use (
7 Ways to Look at the Values of Variables While Debugging in Visual Studio - Azure DevOps Blog[
^]) on
category.Is_Block,category.Category_Id
to determine it's value.
3. Opened up SSMS (
Download SQL Server Management Studio (SSMS) - SQL Server Management Studio (SSMS) | Microsoft Docs[
^]) and ran the query
select * from Category where Category_Id='<<Insert the value from step 2 here>>'
4. One of two things will happen
a) No rows are returned from that query
Your problem is solved. There is no data to update. Go back to the code that is determining the category and work out why.
b) One or more rows are returned
Further investigation is required...
5. Run the query
Update Category SET Category_Code=@Category_Code,Category_Name=@Category_Name,About_Category=@About_Category,Parent_Category_Id=@Parent_Category_Id,Is_Enable=@Is_Enable,Is_Active=@Is_Active,Is_Block=@Is_Block WHERE Category_Id=@Category_Id
By this I mean directly in SSMS - do not call the Stored procedure. Substitute appropriate values for the variables.
6. One of three things will happen
a) The data is successfully updated.
The problem is likely to be in
db.Update
b) An error is reported
Fix that error
c) No error is reported but the data is not updated
Highly unlikely at this point. Do you have permission to update the table? Are you suppressing error messages in someway. Have you checked the Messages pane