如何减少产品数量? [英] How can I decrease the amount of my products?

查看:107
本文介绍了如何减少产品数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





i使用mysql在c#windows窗体中构建项目



i需要减少我在数据库中使用的产品数量,当我使用其中一些产品



时会显示一条消息,说明我没有足够的产品数量



我该怎么做?



我尝试过:



i尝试了一些方法,但在所有尝试中,当我要求的产品数量超过数据库中的产品时,我收到了数据库中的减号



i am building a project in c# windows form using mysql

i need to decrease the amount of the products that i have in the database, when i use some of them

with a message that says that i dont have enough amount of products available

how can i do this?

What I have tried:

i tried some ways but in all the tries i recieved a minus in the database when i ask for more products than i have in the database

推荐答案

有两种方法:

1)编写一个存储过程,根据当前请求检查库存水平,如果没有足够的话,拒绝它。



2)使用交易来降低库存水平,如果结果为负则回滚



我们不知道你的DB是如何组织的,或者你的代码是如何工作的,所以真的没有很多人我们可以建议 - 我们不能具体!
There are two ways:
1) Write a Stored Procedure that checks the stock level against the current request, and refuses it if there aren't enough.
Or
2) Use a Transaction to reduce the stock level, and roll it back if the result is negative

We have no idea how you DB is organised, or how your code works, so there really isn't a lot else we can suggest - we can't be specific!


这篇关于如何减少产品数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆