C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » .NET »

Need idea , How can i accomplish this update Statement scenario


Posted Date: 03 Nov 2009      Posted By: H.Hemdan      Member Level: Bronze     Points: 1   Responses: 2



look ,

lets assume that i have 2 tables

first one called Products ( ProductID,ProductQuantity)

second one called OrdersIN (OrderID,ProductID,QuantityIN)

Products Have those rows

ProductID ProductQuantity

100 0

okay and then we make 2 orders to have those 2 rows like that

OrderID ProductID QuantityIN
10 100 50
11 100 20


then the Products Table looklike become like that

ProductID ProductQuantity
100 70




all of that done with small windows form and some buttons and textboxs okay

what i wanna do is ,,, how can i make change to the OrderID in QuantityIN and replace the value that added to the ProductQuantity with the new value to have a right Value in ProductQuantity

thats all ,,, i hope somebody help me what i have to search or look for to accomplish that







Responses

Author: K Hari Prasad    03 Nov 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

write a stored procedure, pass as productid input

stored procedure contains following statement.

UPDATE Products
SET QuantityIn = (SELECT SUM(QuanityIn)
FROM OrdersIn
WHERE ProductId = @ProductId)
WHERE ProductId = @ProductId



Author: vineeth kumar    03 Nov 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

hi make a stored procedure first for insert value
and use datagridview to display the values in the form
use buttons name save and inside that call the stored procedure



Post Reply
You must Sign In to post a response.
Next : Create A property of class using selection of list
Previous : Employee entry form using asp with c# urgent
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use