Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 688

22 digit number read as double, scientific notation, need string

$
0
0
Hello, I work for a company that has a lot of Classic ASP/VB Script code I have to maintain while we slowly convert everything. One problem I recently ran into is we switched shipping providers and the format of the tracking numbers changed. They used to be a format 1Zxxxxxxx. Because of the letter, it would store it as a string by default. But now the tracking numbers are 22 digit numbers in the CSV.

the CSV file contains ,9405511202537557131488, as a shipping tracking number

The Code is as follows:

Code:

'<!-- Open the data file  -->
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "SELECT * FROM [tracking-numbers-import.csv]"
rs.Open sql, c, 3, 1

varRecordCount = 1

  Do While Not rs.EOF
       
        trackingNo = rs("Tracking #")
        response.write trackingNo & "<br>" 
         
        varRecordCount = varRecordCount + 1 
        rs.MoveNext
  Loop
 
  Set rs = Nothing
       
'<!-- Cleanup -->
 
  cABC.Close
  Set cABC = Nothing

The output of the response.write is: 4.02025375327405E+16

I can format this as a Double with 22 digits, however because of the limitations of a double, the number comes out as 9405511202537600000000

If I edit the CSV and put quotes around the tracking number "9405511202537557131488" it imports as a string, but i cant ask a non-technical shipping person to do that manually to hundreds of tracking numbers per day.

How can I import this as a string in the first place?

- Kevin

Viewing all articles
Browse latest Browse all 688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>