Click here to Skip to main content
15,886,752 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
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
Posted
Updated 12-Jul-11 0:48am
v3
Comments
musefan 12-Jul-11 6:22am    
Can you explain some more of your requirements. Currently they are not clear.

Are you saying that you want to store the data stored in your FIFO implementation (i.e. the current queue) into a database?
vanishangar 12-Jul-11 6:43am    
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)
vanishangar 12-Jul-11 6:42am    
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)

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.
 
Share this answer
 
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).
 
Share this answer
 
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. Insert (a) record(s) into your table.
  2. Fetch records in a FIFO manner:
    SQL
    SELECT TOP 1 * FROM YourTable ORDER BY id ASC
  3. After processing of record is done delete the record in FIFO manner:
    SQL
    DELETE FROM YourTable WHERE id = (SELECT TOP 1 id FROM YourTable ORDER BY id ASC)



Cheers!

—MRB
 
Share this answer
 
v2
Comments
vanishangar 12-Jul-11 6:53am    
please do u know any site for reference or sample coding let me know please

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900