Hi
I have an issue with an asp page that reads from an Excel file. I read the
file using OLEDB. I create a new Excel file using "MS Excel 2003" and put
the following data into a sheet called "Ark1" (2 columns and 5 rows):
1234 reer
1234 feb
4467 heerh
4467 123123
1122 234561122
Then I save the sheet and open an ASP page that has the following code:
Set conn = CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPath &
";Extended properties=""Excel 8.0;HDR=NO;"""
set rs = conn.Execute("Select * FROM [Ark1$]")
while not rs.eof
response.write("<br>" & rs(0) & " : " & rs(1))
rs.movenext
wend
And this is the result (with HTML code):
<br>1234 : reer<br>1234 : feb<br>4467 : heerh<br>4467 : <br>1122 :
If I replace <br> with a line-break, the result looks like this:
1234 : reer
1234 : feb
4467 : heerh
4467 :
1122 :
As you can see, las two iterations doesn't print the rs(1)) correctly.
Instead of printing the correct value, only a blank string is printed.
Initially I didn't make any formatting in the Excel sheet at all, but
formatting all columns in the sheet as "text" didn't help.
I've made several test files with random data in the two columns. It always
works fine when there is at least one none-digit character in the fields,
but when there are only numeric characters, it sometimes displays correctly,
and sometimes doesn't. The numbers in the first column also disappears
sometimes, it's not only the numbers in the second row.
Could you please help me with this issue? Thanks in advance.