I use this code in vb.net for reading in csv files:
filename = TextBox1.Text
FileOpen(1, filename, OpenMode.Input)
'first row contains header information, therefore read it in, but ignore it
dummy = LineInput(1)
While Not EOF(1)
Input(1, dialcode)
Input(1, chargecode)
Input(1, description)
Input(1, mincharge)
Input(1, onpeak)
Input(1, offpeak)
Input(1, weekendonpeak)
Input(1, weekendoffpeak)
Input(1, onpeakconnect)
Input(1, offpeakconnect)
Input(1, weekendonpeakconnect)
Input(1, weekendoffpeakconnect)
End While
this work fine
but i now have a different CSV to read in, and it has a , at the end of each line when i open the CSV file in notepad, so its not reading each row in because vb.net is unsure when a row ends
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…