Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello there,
I am planning to develop a supermarket management system but i intend to integrate a barcode reader so as to read prices & other details on the goods but i need advice on how to get barcode information read by the barcode reader into my application.
I intend to use C#, Sql server or mysql or access
Thanx in advance
Posted
Comments
Richard MacCutchan 8-May-15 5:48am    
You need to check the documentation of the barcode reader. Most such devices present their data as characters.

You don't.
A barcode doesn't contain pricing information (or at least the type used on products (consumer units) or cartons of products (traded units) don't. All they contain is an Article Number - a globally unique number which identifies a specific product and the size of that product - so a 200g pack of ginger nut biscuits will have a different Article Number to a 400g pack of biscuits from the same supplier.

Your code uses the Article Number to index into a stock database and retrieve the item description, current price per unit, special offers, and any other information you need.
The only exception to this is for Deli cut items which have a special type of barcode which returns a company specific number type which indicates an individual purchase, and which is created on the fly when the product is cut and packed for you.

To do this, most barcode scanners are shipped to emulate a keyboard, and the Article Number is fed into your application data input stream as if it had been typed on the keyboard. So provided your app has a textbox or similar the data will be entered there, you read it, clear the textbox and start your database checks.
However they can be configured to give a prefix and / or suffix character so that you can differentiate scanner input from genuine user input. How you configure them is down to the individual manufacturers (and indeed models)
 
Share this answer
 
Comments
Sascha Lefèvre 8-May-15 6:37am    
+5!
Adding to what OriginalGriff wrote in his solution:

Reading barcodes from a textbox has the disadvantage that you have to ensure that the textbox always has the input focus.

There are two alternatives that I know of:

Depending on the manufacturer and type of barcode scanner there can be a manufacturer-provided SDK which could be used to receive the scanned barcodes via some kind of "dedicated" event in your application. I only know this from reading about it, I can't tell for which manufacturers and types of barcode scanners this would be an option; you would have to ask the manufacturers or distributors.

The other alternative is a generic one which should work for any barcode scanner with keyboard emulation. It works by reading the raw keyboard input (which is normally abstracted away by the CLR), which allows to identify the individual device from which key events where sent; even without a textbox. By enumerating the keyboard-devices before and after connecting a barcode scanner with keyboard emulation you can figure out the device-ID of the barcode scanner and then let your application filter out its key events and process them as a scanned barcode. This Codeproject-article presents a way to do this:
Using Raw Input from C# to handle multiple keyboards[^]
 
Share this answer
 

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