Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 15, 2012 06:13 PM by pnoneal
Feb 10, 2012 06:37 PM|LINK
Hello. I have a database with a table containing multiple prices for a single product and there are multiple products in the table.
I need to get a specific price depending and the amount of product. If a customer has 100lbs he gets 3.50 a product if he has more he gets 3.45...
i need it to read a txtbox for the amount Then get the right price from the database. But i have no clue how to do it. Im not sure if it must be done from the Sql statement or in the .vb file.
Feb 10, 2012 07:30 PM|LINK
you can call a STORED PROCEDURE to return the price for the amount you read from the textbox
Feb 12, 2012 01:33 AM|LINK
need to get a specific price depending and the amount of product. If a customer has 100lbs he gets 3.50 a product if he has more he gets 3.45...
What's your table structure？And what's the calculation rule？
Feb 13, 2012 05:25 PM|LINK
This is My table... the prices aren't official yet so they'll be changed later.
what i need it to do is watch my textbox and change the value in a dropdownlist.
So if the textbox value is 100 it should get the price from Price100...
If the value is 500 then the price selected should be Price500..
I need a VB Statement that will do this... Or an Sql Statement.
Feb 14, 2012 12:12 AM|LINK
You can write a stored procudure to deal with this kind of problem——
Create Procdure XXX
declare @price decimal
select @price= top 1 Price100 from xxx where commodityId=@commodityId
select @price= top 1 Price500 from xxx where commodityId=@commodityId
select @price= top 1 Price501 from xxx where commodityId=@commodityId
And then plz use SqlCommand to call the Stored procdure and get the result，for this plz see：
Feb 15, 2012 06:13 PM|LINK
Not sure of your database structure, but if you don't store the price per differing amounts then you have to calculate the values in your business logic. It would probably be some type of percentage based on quantity. So we need to know if you store the
$ amouns for differing quantities in the DB. Then we can go from there