G
Guest
Hi,
I'm trying to read a CSV file into a database using the ReadLine method. Here is the code I've used:
Dim fs, f
Dim strLine As String
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.opentextfile(strSourceFile, 1, 0)
strLine = f.readline
If it reads the following line it works:
2,06730001,HODGE HILL COMPREHENSIVE SCHOO,LGL21902,07/07/2004,21,H,,Bromford Rd,BIRMINGHAM,West Midlands,,,B36 8HB,2093.32,366.33,2459.65,017.500,366.33,000.000,0.00,000.000,0.00, ,000.430,192.74,000.000,0.00,000.000,0.00,1425026100000,845,,127,00,I
However if it reads the following line it doesn't:
2,06730002,HOLYHEAD LEISURE CENTRE,LGL21903,07/07/2004,21,H,,Florence Rd,Handsworth,BIRMINGHAM,West Midlands,,B21 0HN,2387.57,417.82,2805.39,017.500,417.82,000.000,0.00,000.000,0.00, ,000.430,218.77,000.000,0.00,000.000,0.00,1425186100009,845,,127,00,I
With the second line, ReadLine returns the expected string up to the "0.00" just before the blank field. After that it returns a whole load of spaces and then the "I" at the end of the line.
Any ideas what's going wrong here?
Thanks
Neil
I'm trying to read a CSV file into a database using the ReadLine method. Here is the code I've used:
Dim fs, f
Dim strLine As String
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.opentextfile(strSourceFile, 1, 0)
strLine = f.readline
If it reads the following line it works:
2,06730001,HODGE HILL COMPREHENSIVE SCHOO,LGL21902,07/07/2004,21,H,,Bromford Rd,BIRMINGHAM,West Midlands,,,B36 8HB,2093.32,366.33,2459.65,017.500,366.33,000.000,0.00,000.000,0.00, ,000.430,192.74,000.000,0.00,000.000,0.00,1425026100000,845,,127,00,I
However if it reads the following line it doesn't:
2,06730002,HOLYHEAD LEISURE CENTRE,LGL21903,07/07/2004,21,H,,Florence Rd,Handsworth,BIRMINGHAM,West Midlands,,B21 0HN,2387.57,417.82,2805.39,017.500,417.82,000.000,0.00,000.000,0.00, ,000.430,218.77,000.000,0.00,000.000,0.00,1425186100009,845,,127,00,I
With the second line, ReadLine returns the expected string up to the "0.00" just before the blank field. After that it returns a whole load of spaces and then the "I" at the end of the line.
Any ideas what's going wrong here?
Thanks
Neil