c# 4.0 - C# and the CSV file -


I have formatted this data using c #, streamreader and author and created this CSV file. Here is sample data:

  a ------ BC --- D ---------- E ----------- - F ------ G ------ H ------- I New, C, A323, 08/24/2011 / 08 / 24/2011, 100.00,100.00, X 123456,276135 New, C, A 125, 08/24/2011,08 / 24/2011, 200.00.0000.00, X 123456,276135 New, C, A772, 08/24 / 2011,08 / 24/2011, 50.00,100.00, X 123456,276135 New, T, A122, 08/24 / 2011,08 / 24/2011, 5.00,100.00, X 225511,276136 New, T, A124, 08/24 / 2011,08 / 24/2011, 10.00,100.00, X 225511,276136 New, T, A133, 08/24/2011,08 / 24/2011, 500.00,100.00, x 444556,276137 I want the following output: New, C, A 123, 08/24 / 2011,08 / 24/2011, 100.00, 100.00, X 123456,276135 New, C, A 125, 08/24/2011,08 / 24/2011, 200.00.0000.00, X 123456,276135 New, C, A7 127, 08/24 / 2011,08 / 24/2011, 50.00, 100.00, X 123456,276135 New, C, A 1001, 08/24 / 2011,08 / 24/2011, 350.00.0000.00, X 123456,276135 New, T, A122, 08/24/2011 / 24/2011, 5.00, 100.00, X 225511,276136 New, T, A124 , 08/24/2011,08 / 24/2011, 10.00,100.00, X 225511,276136 New, T, A01, 08/24/2011 / 18/24/2011, 15.00, 100.00, X 225511,276136 New, T , A133, 08/24/20 11,08 / 24/2011, 500.00,100.00, X444556,276137 New, T, AX, 08/24/2011 / 08.08 / 24/2011, 500.00,100.00, X 225511, 276137   

With each change in field "I", I would like to add a line, sum By adding column F, "A001" to C, and copying the contents of other areas into the new ADD line.

The letters given on the columns are for clear purposes only, there are no headers.

First of all, what should I do first? How do I add to the column F, copy the contents of all areas, and add "A001" to C? How do I add a line and make a copy of the field / each change in I?

Your data does not sound like your data, a flat file format fits very well , Or at least one CSV (not equal in a single DB table). Copying the contents of 'other areas into that new addition line' means that I mean that a relationship can be better expressed rather than copying data in a new line.

Considering the requirement of the amount according to the column 'F', it is suggested that to calculate the sum, you have to repeat each row again.

If you decide to go any other way than a CSV, then you can try a light weight database solution such as An option can be seen or (with a serializer) and can only work with objects in your code. The objects can then be serialized on the disk when you do them.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -