Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > number to string

Reply
Thread Tools

number to string

 
 
atse
Guest
Posts: n/a
 
      10-05-2003
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


 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      10-05-2003
How are you "selecting" it and "displaying" it?

Ray at home

"atse" <> wrote in message
newsuMfb.102429$ 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
>
>



 
Reply With Quote
 
 
 
 
atse
Guest
Posts: n/a
 
      10-06-2003
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:%...
> How are you "selecting" it and "displaying" it?
>
> Ray at home
>
> "atse" <> wrote in message
> newsuMfb.102429$ 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
> >
> >

>
> >



 
Reply With Quote
 
Ray at
Guest
Posts: n/a
 
      10-06-2003
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" <> wrote in message
news:lv2gb.34706$ko%. 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:%...
> > How are you "selecting" it and "displaying" it?
> >
> > Ray at home
> >
> > "atse" <> wrote in message
> > newsuMfb.102429$ 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
> > >
> > >

> >
> > >

>
>



 
Reply With Quote
 
atse
Guest
Posts: n/a
 
      10-06-2003
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:...
> 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" <> wrote in message
> news:lv2gb.34706$ko%. 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:%...
> > > How are you "selecting" it and "displaying" it?
> > >
> > > Ray at home
> > >
> > > "atse" <> wrote in message
> > > newsuMfb.102429$ 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
> > > >
> > > >
> > >
> > > >

> >
> >

>
>



 
Reply With Quote
 
Ray at
Guest
Posts: n/a
 
      10-06-2003
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" <> wrote in message
news:wx5gb.234968$. 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



 
Reply With Quote
 
atse
Guest
Posts: n/a
 
      10-06-2003
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:...
> 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" <> wrote in message
> news:wx5gb.234968$. 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

>
>



 
Reply With Quote
 
Mark Schupp
Guest
Posts: n/a
 
      10-06-2003
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 documentation at Microsoft for the text
drivers.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com


"atse" <> wrote in message
news:aJigb.239433$ 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:...
> > 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" <> wrote in message
> > news:wx5gb.234968$. 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

> >
> >

>
>



 
Reply With Quote
 
atse
Guest
Posts: n/a
 
      10-06-2003
' 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" <> wrote in message
news:...
> 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 documentation at Microsoft for the text
> drivers.
>
> --
> Mark Schupp
> Head of Development
> Integrity eLearning
> www.ielearning.com
>
>
> "atse" <> wrote in message
> news:aJigb.239433$ 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:...
> > > 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" <> wrote in message
> > > news:wx5gb.234968$. 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
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Mark Schupp
Guest
Posts: n/a
 
      10-06-2003
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 documentation 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
www.ielearning.com


"atse" <> wrote in message
newsBmgb.42321$ko%. 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" <> wrote in message
> news:...
> > 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 documentation at Microsoft for the text
> > drivers.
> >
> > --
> > Mark Schupp
> > Head of Development
> > Integrity eLearning
> > www.ielearning.com
> >
> >
> > "atse" <> wrote in message
> > news:aJigb.239433$ 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:...
> > > > 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" <> wrote in message
> > > >

news:wx5gb.234968$. 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
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting a number back to it's original string (that was hashed togenerate that number) Ferrous Cranus Python 7 01-23-2013 03:30 PM
convert string number to real number - ValueError: invalid literal davidj411 Python 11 05-29-2008 12:02 AM
OT: Number Nine, Number Nine, Number Nine Frisbee MCSE 37 09-26-2005 04:06 PM
HELP - how to convert a string representation of a number to a number ? cpptutor2000@yahoo.com C++ 5 05-21-2005 05:56 PM
Interrogating string for number of characters, response.writing identical number of characters on new line Ken Fine ASP General 2 02-05-2004 03:40 AM



Advertisments
 



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