I have a program that writes to a text file with the "\n" character. I have it write this to a .csv file so that I can then take that information and import it into an Access database. The issue that I am running into is that Microsoft Access VBA and Notepad are not recognizing the line breaks within the file. Wordpad, Access's built in Import, and Excel DO recognize the line breaks. If I open the .csv file in Excel or WordPad, make no changes, and save the file as a .csv file again, then it will show up right.
I have a VBA script to import the data from the file, since data is repeatedly added to a master sheet. I want it to take each line from a .csv file and either insert it as a new row if the ID isn't already present OR update the existing row if there is one. This is tested and working for file where they are blatantly on different rows (showing in notepad as different rows), but it is just the files generated by my program (using \n as new line).
The other program is built in C# ... So, i guess my question is: is there is a better line break character or sequence to use in C# to make it more universally recognized when a line break is present?
For posterity, here is the code that my VBA script is using that is reading the file as one line and missing the line breaks:
'Now read the file
Open csvLoc For Input As #1
Do While Not EOF(1)
Line Input #1, csvLine
Debug.Print csvLine
lineArray = Split(csvLine, ",")
<-- Code handling the now split line array -->
Loop
Close #1