---
title: "C # update And Delete"  
description: "C # update And Delete"  
author: "Sagar Ambre"  
published: 2016-02-25  
updated: 2016-02-28  
canonical: https://www.mindstick.com/forum/34004/c-update-and-delete  
category: "c#"  
tags: ["winforms"]  
reading_time: 5 minutes  

---

# C # update And Delete

Hi,\
Sir I want to know about [Update and Delete](https://www.mindstick.com/forum/156863/create-xml-file-and-also-update-and-delete-that-xml-file-automatically-in-asp-dot-net-mvc) sql [table in c#](https://www.mindstick.com/forum/159584/what-are-the-differences-between-a-hashmap-and-a-hash-table-in-c-sharp).net with windows application..\
When i save my [data in database](https://www.mindstick.com/forum/34103/how-to-insert-data-in-database-using-sencha-touch-extjs) in sale form like following fields.....0)date ,1)custid , 2)custnm ,3)itemid ,4)itemnm ,5)itemqty ,6)itemrate ,7)totalRs...\
i saved following data suppose :\
A] i have 20 biscuit packs in my stock table.\
B]Date :24/02/2016 , custid :1 , custnm : Sagar , itemid : 101 , itemnm : biscuit , itemqty : 10 , itemrate : 5 , totalRs : 50.\
C]so my account balance is 50. bcoz it is my income..so in my Balance Table i have 50 rs.\
D]and my stock is biscuit = 10 packs .\
E]now [customer](https://www.mindstick.com/articles/325839/how-to-improve-your-business-level-of-customer-service) came and he replace the 5 biscuit pack . \
F]So i want to do like this on sales return form.... \
date : 25/02/2016 , custid : 1 , custnm : Sagar , itemid : 101 , itemnm : biscuit , itemqty : 5 , itemrate : 5 , totalRs : 25.\
when i done this entry i want to update my stock and balance table like this ...\
| 1] Start Stock = 20 ; | 1]start balance = 0 ;\
Stock | 2]After Sale = 10 ; Balance| 2]After Sale = 50 ;\
| 3]After Sale Return = 15; | 3]After Sale Return = 25\
\
\
So Please help me how to do it in my [programs](https://www.mindstick.com/forum/157528/how-exceptions-can-be-handled-in-sql-server-programs) bcoz i m doing [inventory](https://www.mindstick.com/articles/330314/5-inventory-management-techniques-to-boost-efficiency) [software](https://www.mindstick.com/articles/311636/best-freelancing-websites-to-get-software-development-services) if i delete the [transaction](https://www.mindstick.com/blog/175/transactions-in-database) then \
My balance want to = 0 ; and Stock Want to = 20 So please Help Me\
\

## Replies

### Reply by Sagar Ambre

Hi ,\
Now anyone tell me the use of trigger in C#.net for this query with example and snapshot..please..please\
\
I want to know about Update and Delete [sql table](https://www.mindstick.com/forum/160519/how-can-i-update-sql-table-by-dataset-data-in-ado-dot-net) in c#.net with windows application..\
When i save my data in database in sale form like following fields.....0)date ,1)custid , 2)custnm ,3)itemid ,4)itemnm ,5)itemqty ,6)itemrate ,7)totalRs...\
i saved following data suppose :\
A] i have 20 biscuit packs in my stock table.\
B]Date :24/02/2016 , custid :1 , custnm : Sagar , itemid : 101 , itemnm : biscuit , itemqty : 10 , itemrate : 5 , totalRs : 50.\
C]so my account balance is 50. bcoz it is my income..so in my Balance Table i have 50 rs.\
D]and my stock is biscuit = 10 packs .\
E]now customer came and he replace the 5 biscuit pack . \
F]So i want to do like this on sales return form.... \
date : 25/02/2016 , custid : 1 , custnm : Sagar , itemid : 101 , itemnm : biscuit , itemqty : 5 , itemrate : 5 , totalRs : 25.\
when i done this entry i want to update my stock and balance table like this ...\
| 1] Start Stock = 20 ; | 1]start balance = 0 ;\
Stock | 2]After Sale = 10 ; Balance| 2]After Sale = 50 ;\
| 3]After Sale Return = 15; | 3]After Sale Return = 25\
\
\
So Please help me how to do it in my programs bcoz i m doing inventory software if i delete the transaction then \
My balance want to = 0 ; and Stock Want to = 20 So please Help Me\

### Reply by Anupam Mishra

Their are many online solution are available, i personally suggest you to download sample project on inventory and try to build according your requirement with the help of sample . For SQL Server this video is useful, Link is below:[https://www.youtube.com/watch?v=0fhcu6Z1DKk](https://www.youtube.com/watch?v=0fhcu6Z1DKk)\
\

### Reply by Sagar Ambre

Thank you Very much sir ,\
but i kindly request you can you show me with Example and coding in c#.net with sql server database\
step by step, because i really need it please sir \
please help me in step by step other wise suggest site or video to me ...please \
once again thanks for help me...\
Regards Sagar\

### Reply by Anupam Mishra

Hi Sagar,I have considered your problem and i want to give a simple approach to better confine to handle this problem, if you will creating a separate table for each entity like **SALES**, **PURCHASE_RETURN** , **SALES_RETURN**, and **STOCK and** Finally we create a view for **Balance**. Here, below are **STOCK** table i.e initially item in the inventory ![C # update And Delete](https://www.mindstick.com/mindstickforums/45e5639e-73e6-4cd2-b414-9d68f93533c2/images/7b697bb1-3a0d-4d97-a12a-f074ec1bc3ff.png):\
Here below our **SALE** table data:\
![C # update And Delete](https://www.mindstick.com/mindstickforums/45e5639e-73e6-4cd2-b414-9d68f93533c2/images/a0d41b4b-b405-404f-927e-2fc99457dceb.png)\
\
Now next table is **PURCHASE_RETURN****\**![C # update And Delete](https://www.mindstick.com/mindstickforums/45e5639e-73e6-4cd2-b414-9d68f93533c2/images/80bc6a7e-8861-41b7-9c7e-7f367dc8d0c6.png)**\**Here, we are **returning 5 biscuit packets. So below is SALES_RETURN**:\
![C # update And Delete](https://www.mindstick.com/mindstickforums/45e5639e-73e6-4cd2-b414-9d68f93533c2/images/1928dc34-60c7-4b36-9005-d7b2ba6aaafa.png)\
Now we are creating a **[database](https://www.mindstick.com/articles/12226/use-of-database-in-sencha-extjs-and-insert-record-from-user-form-using-ajax) view** for Checking current status of **Balance**:\
![C # update And Delete](https://www.mindstick.com/mindstickforums/45e5639e-73e6-4cd2-b414-9d68f93533c2/images/9ae23549-7ce3-44cf-b817-278752d55b6a.png)\
\
and finally a closure look of the **Balance** View: \
![C # update And Delete](https://www.mindstick.com/mindstickforums/45e5639e-73e6-4cd2-b414-9d68f93533c2/images/d6a22ad1-ac0b-404f-a41a-8cf8ad7e233d.png)\
\
So, you don't worry about deletion and updation in inventory. your output is according to your current status. I think this is a final output matches as your requirement that is mentioned in your problem.\
\
\
**\**


---

Original Source: https://www.mindstick.com/forum/34004/c-update-and-delete

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
