943,929 Members | Top Members by Rank

Ad:
Aug 8th, 2005
0

sql query updating problem

Expand Post »
I'm creating a sales invoice order form and whenever a purchase is made, the quantity of a certain product ordered is deducted from the product database. how do i do that? I am using this sql query to get the product details input from vb to the database.

SELECT Invoice_Detail.[InvoiceNo], Invoice_Detail.Product_Code, Items.Description, Invoice_Detail.Qty, Invoice_Detail.Price, Invoice_Detail.Discount_Per, Items.[Sales_Price], ([Qty]*([Price]-[Price]*[DISCOUNT_PER]/100)) AS inv_amount
FROM Items INNER JOIN Invoice_detail1 AS invoice_detail ON Items.[Product_Code] = Invoice_detail.Product_Code;

is there a way to add an extra syntax in there to update the products table to reflect the new quantity? thanks!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
reyhan12 is offline Offline
18 posts
since Jul 2005
Aug 8th, 2005
0

Re: sql query updating problem

Well what I would suggest, to make things easier, SELECT the values from the DB and have them stored in a variable on the VB side, then do your calculations, and post the results back to the DB.

Or even better, create a Stored Procedure which you pass the variables into, and have the DB do the calculations and run the UPDATE sql statement to update the data.

Hope this helps..
Team Colleague
Reputation Points: 211
Solved Threads: 27
Master Poster
Paladine is offline Offline
793 posts
since Feb 2003

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: How to convert wav to mp3 using VB?
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Setting Timer/Clock Precision





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC