多用户库存数据库的MS访问权限 [英] MS access for multi-user inventory database

查看:82
本文介绍了多用户库存数据库的MS访问权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为Inventory控件和多个用户设置Access数据库。我的想法是输入并保留库存运动的记录:增加,减少,贷款,转换(销售库存到演示)等。然后,库存
的当前状态将通过累加所有运动来获得对于每个项目,加上我会保留一段时间内发生的事情的历史记录。


我想知道,如果它与多个用户兼容。例如,要销售商品,我会有一个临时表,其中包含所有小工具A(带有序列号),然后用户会选择正确的序列号,然后该商品将售出
。但如果两个人同时出售物品,他们会互相干扰吗?例如,"items_temp"表示"items_temp"。 table必须在开头清除,所以如果用户1清除它然后开始用项填充它,然后
然后user2开始销售并清除临时表,它将删除user1所做的一切。你怎么在访问中避免这种情况?

解决方案

为什么你认为"临时"?需要桌子吗?我99%确信它不是。你能解释一下为什么这比永久表好吗?


我不是100%确定你的场景是什么(关于你的数据库设计的细节不够),但让我推测你有一个产品表,你有一个ProductSerialNumbers表。然后你有一个零售店,人们购买这些产品,你需要
来记录每次购买的序列号。店员会查看该项目,并使用条形码扫描仪或键盘输入序列号,然后点击保存以记录销售。


两个职员可能不会输入相同的序列号(但以防万一:唯一索引);毕竟两个顾客出现在结账登记处有两个不同的项目。假设输入了两个数字,同时点击了保存。


然后,我们需要将此次销售写入该表的OrderDetail记录。它将有一个额外的SerialNo字段。


给定标准的乐观锁定(和NO,悲观锁定不适合你),锁定仅应用保存记录所需的几毫秒。但是两个拯救确实会发生碰撞的确有一个非常小的机会。这是您的错误
处理程序将启动的位置,user2将触发此错误处理程序。现在由你来决定如何处理它。一个建议是进入睡眠100毫秒并再次尝试(恢复),最多十次,甚至在向用户显示任何消息之前。锁定很可能在这段时间内被清理掉,而第二次保存将会成功。之后,您可以显示"数据库忙 - 想再等一下"或"取消"?信息。这一切都取决于你的解决方案的许多细节,我们现在不知道这是多少。




I am trying to set up an Access database for Inventory control and for multiple users. My idea was to enter and keep a record of inventory movments: additions, subtractions, loans, conversions (sale inventory to demo), etc. The current status of the inventory would then, for example available by adding up all movements for each item, plus I would retain a history of what happened over time.

I am wondering, though, if that is compatible with multiple users. For example, to sell an item, I would have a temporary table with all items of gadget A (with serial numbers), and a user would then pick the right serial number and then that item would be sold. But if two people were selling items at the same time, would they interfere with each other? For example, the "items_temp" table would have to be cleared at the beginning, so if user 1 clears it then starts populating it with items, and then user2 starts selling and clears the temp table, it would delete everything that user1 had done. How do you avoid that in access?

解决方案

Why do you think a "temp" table is needed? I'm 99% convinced it is not. Can you explain why that's better than a permanent table?

I'm not 100% sure what your scenario is (not enough details about your db design), but let me speculate you have a Products table, and you have a ProductSerialNumbers table. Then you have a retail outlet where people buy those products, and you are required to record the serial number of each purchase. The clerk would look at the item, and use a barcode scanner or a keyboard to enter the serial number, then click Save to record the sale.

Two clerks would presumably not enter the same serialno (but just in case: unique index); after all the two customers showed up at the checkout registers with two different items. Say the two numbers were entered, and Save was clicked at the same time.

We then need to write an OrderDetail record with this sale to that table. It would have an extra SerialNo field.

Given standard Optimistic Locking (and NO, pessimistic locking is not for you), the lock is only applied the few milliseconds it takes to save the record. But there is indeed a VERY SMALL chance that the two Saves would collide. This is where your error handler would kick in, and user2 would hit this error handler. Now it's up to you to decide how to handle it. One suggestion is to go to sleep for 100 msec and try again (Resume), up to ten times, before even showing any message to the user. More than likely the lock is long cleared up within this time and the second save will be successful. After that you could show a "database busy - wanna wait some more or Cancel"? message. It all depends on the many finer points of your solution that we are not privy to at this time.


这篇关于多用户库存数据库的MS访问权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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