i try to inport csv file to my database in my C# winform program.
for example the csv file:
code ,name ,price
101010,computer,200$
and i done this:
char[] BI = { ',' };
string[] WI = TEMP.Split(BI);
A = WI[0].Trim().ToString();
B = WI[1].Trim().ToString();
C = WI[2].Trim().ToString();
but what i can do if the name contain (,) ?
for example
code ,name ,price
101010,computer 12,200.00,200$
if i get this type of csv:
code ,name ,price
"101010","computer 12,200.00","200$"
how to deal with this ?
The best thing to do is not roll your own csv and use a existing free library. I recommend FileHelpers.
EDIT:
Here is a fun little read, I bet you are on step 2 or step 3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With