如何增加或减少数据库中字段的值 [英] How to increment or decrement the value of field in database

查看:208
本文介绍了如何增加或减少数据库中字段的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在建立一个库存管理系统(Winforms C#),其中包含帐单.数据库具有表"item",该表具有诸如项目名称,单位,基本价格,数量等字段.

在生成账单的同时,我正在向其中添加项目,其中包含与上述类似的字段.生成帐单后,我需要递减数据库中项目的数量字段的值,该递减值应等于添加到帐单生成中的项目的数量. (这与库存管理中的库存管理有关)

请帮我做一个,并提供编码示例.

在Advance中致谢

Hi,

I am building a inventory management system(Winforms C#), it contains billing. Data base has table "item" having fields such as item name, units, base price, Quantity and so on.

While bill generation i am adding items to it, containing similar fields as above. After bill generation i need to decrement the value of quantity field for items in database, that decrement value should be equal to the quantity of items added to bill generation. (This regarding stock management in inventory management)

Please help me to do this one and provide me coding samples.

Thanks in Advance

推荐答案

到目前为止,您做了/实现了什么?
What have you done / implemented so far?


您需要做一些研究.您可以先研究如何从数据库中获取数据,然后如何进行更新.请尝试这些文章. [ ^ ].如果您有更具体的问题,请发布一个新问题,其中包含有关您的问题的详细信息,出现的任何错误消息,甚至是您遇到问题的代码段.
You need to do some research. You can start by research how to get data from a database and then how to update it. Try these articles.[^]. When you have a more specific question please post a new question with detailed information about your problem, any error messages you are getting, and even a snippet of the code you are having trouble with.


进行查询并获取包含您必须递增/递减的字段的记录集,通过为其分配其递增/递减的值来更改字段,最后将更改提交到记录集...
Make a query and get the recordset that holds the field you have to increment/decrement, the change the field by assigning it its incremented/decremented value, and finally commit the changes to the recordset...


这篇关于如何增加或减少数据库中字段的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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