Professional Web Applications Themes

number to string - ASP

Hi, When I select a filed from a txt or csv file, and display on the ASP, the 16 digit of barcode number (9876543210123456) becomes to 9.87654321012345E+15. How can I make it display the original. Thanks Atse...

  1. #1

    Default number to string

    Hi,

    When I select a filed from a txt or csv file, and display on the ASP, the 16
    digit of barcode number (9876543210123456) becomes to 9.87654321012345E+15.
    How can I make it display the original. Thanks

    Atse


    atse Guest

  2. #2

    Default Re: number to string

    How are you "selecting" it and "displaying" it?

    Ray at home

    "atse" <dunggaze> wrote in message
    news:ouMfb.102429$3r1.80021news02.bloor.is.net.ca ble.rogers.com...
    > Hi,
    >
    > When I select a filed from a txt or csv file, and display on the ASP, the
    16
    > digit of barcode number (9876543210123456) becomes to
    9.87654321012345E+15.
    > How can I make it display the original. Thanks
    >
    > Atse
    >
    >

    Ray at Guest

  3. #3

    Default Re: number to string

    the source code
    <%
    ' pass the filename of a file located in C:\upload\
    file=Request.QueryString("file")

    con_xls="Provider=Microsoft.Jet.OLEDB.4.0;Data
    Source=C:\upload\\test.xls;Extended
    Properties=""Excel 8.0;HDR=Yes;IMEX=1"""
    set conn=server.CreateObject("ADODB.Connection")
    conn.open(con_xls)

    set rs = conn.execute ("select * from " & file)

    %>
    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    </HEAD>
    <BODY>
    <table border=1>
    <%
    if not rs.eof then
    %>
    <% do until rs.EOF %>
    <tr>
    <%
    ' there are 16 columns in this file, but I don't know how to define a
    variable of the number of columns

    for i =0 to 15
    %>
    <td> <%= rs(i)%> </td>
    <%next%>
    </tr>
    <% rs.MoveNext
    loop

    end if
    %>
    </table>
    </BODY>
    </HTML>

    "Ray at <%=sLocation%>" <myfirstname at lane 34 . komm> wrote in message
    news:%23wwQgOwiDHA.2444TK2MSFTNGP12.phx.gbl...
    > How are you "selecting" it and "displaying" it?
    >
    > Ray at home
    >
    > "atse" <dunggaze> wrote in message
    > news:ouMfb.102429$3r1.80021news02.bloor.is.net.ca ble.rogers.com...
    > > Hi,
    > >
    > > When I select a filed from a txt or csv file, and display on the ASP,
    the
    > 16
    > > digit of barcode number (9876543210123456) becomes to
    > 9.87654321012345E+15.
    > > How can I make it display the original. Thanks
    > >
    > > Atse
    > >
    > >
    >
    > >

    atse Guest

  4. #4

    Default Re: number to string

    It seems to me that the only way that you can get this to display directly
    from the RS the way you want is if you format the cell in Excel to display
    the number as text.

    Ray at home

    "atse" <dunggaze> wrote in message
    news:lv2gb.34706$ko%.28378news04.bloor.is.net.cab le.rogers.com...
    > the source code
    > <%
    > ' pass the filename of a file located in C:\upload\
    > file=Request.QueryString("file")
    >
    > con_xls="Provider=Microsoft.Jet.OLEDB.4.0;Data
    > Source=C:\upload\\test.xls;Extended
    > Properties=""Excel 8.0;HDR=Yes;IMEX=1"""
    > set conn=server.CreateObject("ADODB.Connection")
    > conn.open(con_xls)
    >
    > set rs = conn.execute ("select * from " & file)
    >
    > %>
    > <HTML>
    > <HEAD>
    > <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    > </HEAD>
    > <BODY>
    > <table border=1>
    > <%
    > if not rs.eof then
    > %>
    > <% do until rs.EOF %>
    > <tr>
    > <%
    > ' there are 16 columns in this file, but I don't know how to define a
    > variable of the number of columns
    >
    > for i =0 to 15
    > %>
    > <td> <%= rs(i)%> </td>
    > <%next%>
    > </tr>
    > <% rs.MoveNext
    > loop
    >
    > end if
    > %>
    > </table>
    > </BODY>
    > </HTML>
    >
    > "Ray at <%=sLocation%>" <myfirstname at lane 34 . komm> wrote in message
    > news:%23wwQgOwiDHA.2444TK2MSFTNGP12.phx.gbl...
    > > How are you "selecting" it and "displaying" it?
    > >
    > > Ray at home
    > >
    > > "atse" <dunggaze> wrote in message
    > > news:ouMfb.102429$3r1.80021news02.bloor.is.net.ca ble.rogers.com...
    > > > Hi,
    > > >
    > > > When I select a filed from a txt or csv file, and display on the ASP,
    > the
    > > 16
    > > > digit of barcode number (9876543210123456) becomes to
    > > 9.87654321012345E+15.
    > > > How can I make it display the original. Thanks
    > > >
    > > > Atse
    > > >
    > > >
    > >
    > > >
    >
    >

    Ray at Guest

  5. #5

    Default Re: number to string

    I am now trying insert the csv file into the database, and I set this field
    as VARCHAR with length = 50
    but 9876543210123456 in the original file still displays
    9.87654321012345E+15 in the database, ASP,and the exported csv file.
    Any idea to solve this problem

    atse

    "Ray at <%=sLocation%>" <myfirstname at lane 34 . komm> wrote in message
    news:e4Gp9W7iDHA.4064TK2MSFTNGP11.phx.gbl...
    > It seems to me that the only way that you can get this to display directly
    > from the RS the way you want is if you format the cell in Excel to display
    > the number as text.
    >
    > Ray at home
    >
    > "atse" <dunggaze> wrote in message
    > news:lv2gb.34706$ko%.28378news04.bloor.is.net.cab le.rogers.com...
    > > the source code
    > > <%
    > > ' pass the filename of a file located in C:\upload\
    > > file=Request.QueryString("file")
    > >
    > > con_xls="Provider=Microsoft.Jet.OLEDB.4.0;Data
    > > Source=C:\upload\\test.xls;Extended
    > > Properties=""Excel 8.0;HDR=Yes;IMEX=1"""
    > > set conn=server.CreateObject("ADODB.Connection")
    > > conn.open(con_xls)
    > >
    > > set rs = conn.execute ("select * from " & file)
    > >
    > > %>
    > > <HTML>
    > > <HEAD>
    > > <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    > > </HEAD>
    > > <BODY>
    > > <table border=1>
    > > <%
    > > if not rs.eof then
    > > %>
    > > <% do until rs.EOF %>
    > > <tr>
    > > <%
    > > ' there are 16 columns in this file, but I don't know how to define a
    > > variable of the number of columns
    > >
    > > for i =0 to 15
    > > %>
    > > <td> <%= rs(i)%> </td>
    > > <%next%>
    > > </tr>
    > > <% rs.MoveNext
    > > loop
    > >
    > > end if
    > > %>
    > > </table>
    > > </BODY>
    > > </HTML>
    > >
    > > "Ray at <%=sLocation%>" <myfirstname at lane 34 . komm> wrote in message
    > > news:%23wwQgOwiDHA.2444TK2MSFTNGP12.phx.gbl...
    > > > How are you "selecting" it and "displaying" it?
    > > >
    > > > Ray at home
    > > >
    > > > "atse" <dunggaze> wrote in message
    > > > news:ouMfb.102429$3r1.80021news02.bloor.is.net.ca ble.rogers.com...
    > > > > Hi,
    > > > >
    > > > > When I select a filed from a txt or csv file, and display on the
    ASP,
    > > the
    > > > 16
    > > > > digit of barcode number (9876543210123456) becomes to
    > > > 9.87654321012345E+15.
    > > > > How can I make it display the original. Thanks
    > > > >
    > > > > Atse
    > > > >
    > > > >
    > > >
    > > > >
    > >
    > >
    >
    >

    atse Guest

  6. #6

    Default Re: number to string

    What does it look like in the CSV file when you look at it in a text editor,
    such as notepad?

    Ray at home

    "atse" <dunggaze> wrote in message
    news:wx5gb.234968$Lnr1.119488news01.bloor.is.net. cable.rogers.com...
    > I am now trying insert the csv file into the database, and I set this
    field
    > as VARCHAR with length = 50
    > but 9876543210123456 in the original file still displays
    > 9.87654321012345E+15 in the database, ASP,and the exported csv file.
    > Any idea to solve this problem
    >
    > atse

    Ray at Guest

  7. #7

    Default Re: number to string

    The original one in Notepad is OK: 9876543210123456
    after inserted into the database, it looks like 9.87654321012345E+15 (I can
    view the record of database)

    The exported csv file in Notepad and Excel looks like 9.87654321012345E+15

    "Ray at <%=sLocation%>" <myfirstname at lane 34 . komm> wrote in message
    news:uomJgy8iDHA.2416TK2MSFTNGP10.phx.gbl...
    > What does it look like in the CSV file when you look at it in a text
    editor,
    > such as notepad?
    >
    > Ray at home
    >
    > "atse" <dunggaze> wrote in message
    > news:wx5gb.234968$Lnr1.119488news01.bloor.is.net. cable.rogers.com...
    > > I am now trying insert the csv file into the database, and I set this
    > field
    > > as VARCHAR with length = 50
    > > but 9876543210123456 in the original file still displays
    > > 9.87654321012345E+15 in the database, ASP,and the exported csv file.
    > > Any idea to solve this problem
    > >
    > > atse
    >
    >

    atse Guest

  8. #8

    Default Re: number to string

    I came in late on this thread. What tool are you using to import the
    original CSV?

    If you are opening it with the MS Text drivers as a database you will need
    to include a column definition INI file to tell the drivers that the column
    is character data and not numeric (it should also be enclosed in quotes in
    the CSV file). Unfortunately I cannot remember the name that the INI file
    must use. Search through the doentation at Microsoft for the text
    drivers.

    --
    Mark Schupp
    Head of Development
    Integrity eLearning
    [url]www.ielearning.com[/url]


    "atse" <dunggaze> wrote in message
    news:aJigb.239433$Lnr1.64163news01.bloor.is.net.c able.rogers.com...
    > The original one in Notepad is OK: 9876543210123456
    > after inserted into the database, it looks like 9.87654321012345E+15 (I
    can
    > view the record of database)
    >
    > The exported csv file in Notepad and Excel looks like 9.87654321012345E+15
    >
    > "Ray at <%=sLocation%>" <myfirstname at lane 34 . komm> wrote in message
    > news:uomJgy8iDHA.2416TK2MSFTNGP10.phx.gbl...
    > > What does it look like in the CSV file when you look at it in a text
    > editor,
    > > such as notepad?
    > >
    > > Ray at home
    > >
    > > "atse" <dunggaze> wrote in message
    > > news:wx5gb.234968$Lnr1.119488news01.bloor.is.net. cable.rogers.com...
    > > > I am now trying insert the csv file into the database, and I set this
    > > field
    > > > as VARCHAR with length = 50
    > > > but 9876543210123456 in the original file still displays
    > > > 9.87654321012345E+15 in the database, ASP,and the exported csv file.
    > > > Any idea to solve this problem
    > > >
    > > > atse
    > >
    > >
    >
    >

    Mark Schupp Guest

  9. #9

    Default Re: number to string

    ' The text driver is:
    con_csv="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\mypath\;Extended
    Properties=""text;HDR=No;FMT=Delimited"""
    set conn=server.CreateObject("ADODB.Connection")
    conn.open(con_csv)

    ' Because this is a csv file, I can only make a query string:
    set Rs=conn.execute("select * from thisfile.csv")

    ' Then I run a script to insert these records into the database.
    Unfortunately when this long number is inserted into the database, it
    changes to another format as text. How can I make this long number as text
    when inserting into the db? Thanks

    Atse


    "Mark Schupp" <mschuppielearning.com> wrote in message
    news:OjmmYUFjDHA.2644TK2MSFTNGP10.phx.gbl...
    > I came in late on this thread. What tool are you using to import the
    > original CSV?
    >
    > If you are opening it with the MS Text drivers as a database you will need
    > to include a column definition INI file to tell the drivers that the
    column
    > is character data and not numeric (it should also be enclosed in quotes in
    > the CSV file). Unfortunately I cannot remember the name that the INI file
    > must use. Search through the doentation at Microsoft for the text
    > drivers.
    >
    > --
    > Mark Schupp
    > Head of Development
    > Integrity eLearning
    > [url]www.ielearning.com[/url]
    >
    >
    > "atse" <dunggaze> wrote in message
    > news:aJigb.239433$Lnr1.64163news01.bloor.is.net.c able.rogers.com...
    > > The original one in Notepad is OK: 9876543210123456
    > > after inserted into the database, it looks like 9.87654321012345E+15 (I
    > can
    > > view the record of database)
    > >
    > > The exported csv file in Notepad and Excel looks like
    9.87654321012345E+15
    > >
    > > "Ray at <%=sLocation%>" <myfirstname at lane 34 . komm> wrote in message
    > > news:uomJgy8iDHA.2416TK2MSFTNGP10.phx.gbl...
    > > > What does it look like in the CSV file when you look at it in a text
    > > editor,
    > > > such as notepad?
    > > >
    > > > Ray at home
    > > >
    > > > "atse" <dunggaze> wrote in message
    > > > news:wx5gb.234968$Lnr1.119488news01.bloor.is.net. cable.rogers.com...
    > > > > I am now trying insert the csv file into the database, and I set
    this
    > > > field
    > > > > as VARCHAR with length = 50
    > > > > but 9876543210123456 in the original file still displays
    > > > > 9.87654321012345E+15 in the database, ASP,and the exported csv file.
    > > > > Any idea to solve this problem
    > > > >
    > > > > atse
    > > >
    > > >
    > >
    > >
    >
    >

    atse Guest

  10. #10

    Default Re: number to string

    There is a specially formatted INI file that you need to include in the same
    directory as the CSV file to tell the Jet text driver that the column in
    question is String instead of numeric. By default, the text driver "guesses"
    the data type based on the "typical" contents of the column. I cannot
    remember the name of the INI file but you should be able to find it in the
    Microsoft doentation for the desktop drivers (I have to search for it
    every time the subject comes up because I can never remember it).

    --
    Mark Schupp
    Head of Development
    Integrity eLearning
    [url]www.ielearning.com[/url]


    "atse" <dunggaze> wrote in message
    news:pBmgb.42321$ko%.32804news04.bloor.is.net.cab le.rogers.com...
    > ' The text driver is:
    > con_csv="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\mypath\;Extended
    > Properties=""text;HDR=No;FMT=Delimited"""
    > set conn=server.CreateObject("ADODB.Connection")
    > conn.open(con_csv)
    >
    > ' Because this is a csv file, I can only make a query string:
    > set Rs=conn.execute("select * from thisfile.csv")
    >
    > ' Then I run a script to insert these records into the database.
    > Unfortunately when this long number is inserted into the database, it
    > changes to another format as text. How can I make this long number as text
    > when inserting into the db? Thanks
    >
    > Atse
    >
    >
    > "Mark Schupp" <mschuppielearning.com> wrote in message
    > news:OjmmYUFjDHA.2644TK2MSFTNGP10.phx.gbl...
    > > I came in late on this thread. What tool are you using to import the
    > > original CSV?
    > >
    > > If you are opening it with the MS Text drivers as a database you will
    need
    > > to include a column definition INI file to tell the drivers that the
    > column
    > > is character data and not numeric (it should also be enclosed in quotes
    in
    > > the CSV file). Unfortunately I cannot remember the name that the INI
    file
    > > must use. Search through the doentation at Microsoft for the text
    > > drivers.
    > >
    > > --
    > > Mark Schupp
    > > Head of Development
    > > Integrity eLearning
    > > [url]www.ielearning.com[/url]
    > >
    > >
    > > "atse" <dunggaze> wrote in message
    > > news:aJigb.239433$Lnr1.64163news01.bloor.is.net.c able.rogers.com...
    > > > The original one in Notepad is OK: 9876543210123456
    > > > after inserted into the database, it looks like 9.87654321012345E+15
    (I
    > > can
    > > > view the record of database)
    > > >
    > > > The exported csv file in Notepad and Excel looks like
    > 9.87654321012345E+15
    > > >
    > > > "Ray at <%=sLocation%>" <myfirstname at lane 34 . komm> wrote in
    message
    > > > news:uomJgy8iDHA.2416TK2MSFTNGP10.phx.gbl...
    > > > > What does it look like in the CSV file when you look at it in a text
    > > > editor,
    > > > > such as notepad?
    > > > >
    > > > > Ray at home
    > > > >
    > > > > "atse" <dunggaze> wrote in message
    > > > >
    news:wx5gb.234968$Lnr1.119488news01.bloor.is.net. cable.rogers.com...
    > > > > > I am now trying insert the csv file into the database, and I set
    > this
    > > > > field
    > > > > > as VARCHAR with length = 50
    > > > > > but 9876543210123456 in the original file still displays
    > > > > > 9.87654321012345E+15 in the database, ASP,and the exported csv
    file.
    > > > > > Any idea to solve this problem
    > > > > >
    > > > > > atse
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    Mark Schupp Guest

  11. #11

    Default Re: number to string

    Yes, I agree that, but I don't get the driver either:(

    "Mark Schupp" <mschuppielearning.com> wrote in message
    news:eeIN3SGjDHA.2308TK2MSFTNGP09.phx.gbl...
    > There is a specially formatted INI file that you need to include in the
    same
    > directory as the CSV file to tell the Jet text driver that the column in
    > question is String instead of numeric. By default, the text driver
    "guesses"
    > the data type based on the "typical" contents of the column. I cannot
    > remember the name of the INI file but you should be able to find it in the
    > Microsoft doentation for the desktop drivers (I have to search for it
    > every time the subject comes up because I can never remember it).
    >
    > --
    > Mark Schupp
    > Head of Development
    > Integrity eLearning
    > [url]www.ielearning.com[/url]
    >
    >
    > "atse" <dunggaze> wrote in message
    > news:pBmgb.42321$ko%.32804news04.bloor.is.net.cab le.rogers.com...
    > > ' The text driver is:
    > > con_csv="Provider=Microsoft.Jet.OLEDB.4.0;Data
    Source=D:\mypath\;Extended
    > > Properties=""text;HDR=No;FMT=Delimited"""
    > > set conn=server.CreateObject("ADODB.Connection")
    > > conn.open(con_csv)
    > >
    > > ' Because this is a csv file, I can only make a query string:
    > > set Rs=conn.execute("select * from thisfile.csv")
    > >
    > > ' Then I run a script to insert these records into the database.
    > > Unfortunately when this long number is inserted into the database, it
    > > changes to another format as text. How can I make this long number as
    text
    > > when inserting into the db? Thanks
    > >
    > > Atse
    > >
    > >
    > > "Mark Schupp" <mschuppielearning.com> wrote in message
    > > news:OjmmYUFjDHA.2644TK2MSFTNGP10.phx.gbl...
    > > > I came in late on this thread. What tool are you using to import the
    > > > original CSV?
    > > >
    > > > If you are opening it with the MS Text drivers as a database you will
    > need
    > > > to include a column definition INI file to tell the drivers that the
    > > column
    > > > is character data and not numeric (it should also be enclosed in
    quotes
    > in
    > > > the CSV file). Unfortunately I cannot remember the name that the INI
    > file
    > > > must use. Search through the doentation at Microsoft for the text
    > > > drivers.
    > > >
    > > > --
    > > > Mark Schupp
    > > > Head of Development
    > > > Integrity eLearning
    > > > [url]www.ielearning.com[/url]
    > > >
    > > >
    > > > "atse" <dunggaze> wrote in message
    > > > news:aJigb.239433$Lnr1.64163news01.bloor.is.net.c able.rogers.com...
    > > > > The original one in Notepad is OK: 9876543210123456
    > > > > after inserted into the database, it looks like 9.87654321012345E+15
    > (I
    > > > can
    > > > > view the record of database)
    > > > >
    > > > > The exported csv file in Notepad and Excel looks like
    > > 9.87654321012345E+15
    > > > >
    > > > > "Ray at <%=sLocation%>" <myfirstname at lane 34 . komm> wrote in
    > message
    > > > > news:uomJgy8iDHA.2416TK2MSFTNGP10.phx.gbl...
    > > > > > What does it look like in the CSV file when you look at it in a
    text
    > > > > editor,
    > > > > > such as notepad?
    > > > > >
    > > > > > Ray at home
    > > > > >
    > > > > > "atse" <dunggaze> wrote in message
    > > > > >
    > news:wx5gb.234968$Lnr1.119488news01.bloor.is.net. cable.rogers.com...
    > > > > > > I am now trying insert the csv file into the database, and I set
    > > this
    > > > > > field
    > > > > > > as VARCHAR with length = 50
    > > > > > > but 9876543210123456 in the original file still displays
    > > > > > > 9.87654321012345E+15 in the database, ASP,and the exported csv
    > file.
    > > > > > > Any idea to solve this problem
    > > > > > >
    > > > > > > atse
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    atse Guest

Similar Threads

  1. Converting a String to number
    By Kaitlyn_k in forum Macromedia ColdFusion
    Replies: 2
    Last Post: May 3rd, 11:19 PM
  2. Number of Character of a string
    By xcoldnet in forum Macromedia ColdFusion
    Replies: 2
    Last Post: April 1st, 08:41 PM
  3. Split string like 'something.jpg,123' into $filename and $number
    By Martin Lucas-Smith in forum PHP Development
    Replies: 3
    Last Post: December 15th, 05:36 AM
  4. #26071 [Opn->Bgs]: Number 0 is equal to any string.
    By iliaa@php.net in forum PHP Development
    Replies: 0
    Last Post: November 1st, 08:18 PM
  5. #26071 [NEW]: Number 0 is equal to any string.
    By flood87 at hot dot ee in forum PHP Development
    Replies: 0
    Last Post: November 1st, 08:12 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139