先进先出解决方案 [英] First In First Out Solution

查看:150
本文介绍了先进先出解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我在c#.net中创建一个软件,其中具有FIFO功能的Sold and Purchese功能(例如,具有FIFO的库存系统)将savine在月底保存到任何数据库(Access,mysql或sql server)中的数据后,售出商品的成本...是任何人都知道的在任何站点中进行编码的示例.

HI i am creating a software in c#.net there Sold and Purchese function with FIFO function Like Inventory System with FIFO save that data in any Database (Access or mysql or sql server) after savine in the end of month we must calculating cost of good sold ...is any one know sample Coding in any site

推荐答案

VB6是个玩笑.您甚至会问为什么可以使用.NET.

你到底是什么意思?您的意思是将数据存储在数据库中吗?还是在记忆里?无论哪种方式,您都可以按照它说的做.按放入顺序拉出对象,这意味着知道该顺序.
VB6 is a joke. Why would you even ask that if you can use .NET.

What on earth do you mean ? Do you mean store data in the DB ? Or in memory ? Either way, you do what it says. Pull out objects in the order they were put in, which means knowing that order.


如果您需要以与存储它们相同的顺序来检索项目,则可以使用自动递增计数器标记每个项目(如何取决于您使用的技术).
If you need to retrieve the items in the same order you stored them, then you may use an autoincrement counter to mark each item (how to depends on the technology you are using).


由于您在问题中提到了database,因此我假设您要将数据存储到表中并以FIFO方式获取.为此,您可以利用大多数数据库具有的自动递增列功能.因此,当您将记录插入表中时,下一个较高的值将分配给该列.对于此答案的其余部分,我们将此自动递增列称为id.如果表中的最后一行已处理,它将从表中删除.因此,工作流程如下:

Since you mentioned database in your question I''ll assume you want to store data into a table and fetch it in a FIFO manner. For that you can utilize the auto increment column feature that most databases posses. So when you insert a record into your table the next higher value will be assigned to that column. For the rest of this answer let''s call this auto increment column id. If the last row from your table has been processed it will be deleted from you table. So the workflow will be as follows:


  1. 将记录插入表中.
  2. 以FIFO方式获取记录:

  1. Insert (a) record(s) into your table.
  2. Fetch records in a FIFO manner:
SELECT TOP 1 * FROM YourTable ORDER BY id ASC

  • 完成记录处理后,以FIFO方式删除记录:

  • After processing of record is done delete the record in FIFO manner:

    DELETE FROM YourTable WHERE id = (SELECT TOP 1 id FROM YourTable ORDER BY id ASC)





  • 干杯!

    —MRB



    Cheers!

    —MRB


    这篇关于先进先出解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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