I am required to develop a POS system using C# for a small shop which sells items like bread,milk etc... the part that i don't get is this. "The system must first store those items on a text file as follows[item Code,Description,Price] where :
Item Code is 6 characters long. First 3 letters of the item and a 3 digit number e.g Bre123.
Description _ e.g Bread
Price of item
When doing a sale the system must read that particular item code from the file and display it on screen.
All help appreciated.
Loading
Prabhu RajaPosted Oct 8, 2011, 1:42 AM
Also try this.
CSVReader . Click the Link, you will get CSVReader Class, So that you can easily Read CSV files.
we can Read By following,
//Using comma as separator character, first line is treated as column names
DataTable dt = CSVReader.ReadCSVFile("input.csv", true);
And use for loop or foreach loop, to loop through to the datatable. and find particular item and display in screen. (Untested)
foreach (DataRow dr in dt.Rows)
{
foreach(DataColumn column in dt.Columns)
{ // you may use a if condition here to retrieve particular row
Console.WriteLine(row[column]);
}
}
---------------------------------------------------------------
If this post helps you, then mark as "Correct Answer"
Thank you
Javeed M ShaikhPosted Oct 7, 2011, 10:08 PM
// use the mvalues array value here
Please do not forget to mark "Accepted Answer".
Chad FynnPosted Oct 7, 2011, 6:00 PM
Javeed M ShaikhPosted Oct 7, 2011, 4:57 PM