hii guys, please help me to solve my problem.
actually im doing inventory system where one of its function is to automatically detect the stock/product that has reach its limit by using alert message.
for this case, i have product table that consist pid, pname, vendorid, productamount, lead time and safetystockamount.
im doing it using c#.net (visual studio 2010). im using sql server for database.
in my page, i actually will show the product details by using gridview tool in visual studio by referring to product table in my database and when the user first come into the page, the alert message will come out. This alert message only will pop out if there is one or more product that reached its stock limit. If all the product amount are in more than safetyamount then this alert message will not coming up.
my sql command for this function is :
select case when (P_Amount <= SafetyStockamount)
then 'Limit stock has been reached'
end as Alert
from Product </code>
when i execute this statement in my sql server management studio then the result will show the list of product stock level condition. if the product amount is less than safetystockamount then it will show 'limit stock has been reached' while if the product amount is in good condition then it will be 'null'.
For the c# code i also tried to combine both alert message code and sql command but as i can see the program only execute the alert message code so everytime when i open the page then the alert message will pop up. It will happen everytime which means even though one of the product amount is still in good condition (> then safetystockamount), the pop up alert also will come out. @@
below is my c# code :
SqlConnection connection = new SqlConnection("Data Source=MELINA_YEO-VAIO; Initial Catalog=InventorySystem; Integrated Security=True");
SqlCommand abc = new SqlCommand("Select case when (P_Amount <= SafetyStockamount) then 'Limit stock has been reached' end as Alert from Product");
alert('Limit stock has been reached!');
please give me solution for this problem. thanks in advance :)