Hello,
I have the following code to write each columns in a
datarow to the csv file:
myStreamWriter.Write(chr(34) & (myDr(I).ToString) & chr(34)
& ",")
I have a string field with the value of "000000". When I
open the file in Excel, the value displayed as "0". But I
really need to keep the way it is in the database. I tried
the following:
myStreamWriter.Write(chr(39) & (myDr(I).ToString) & ",")
It displayed as "'000000".
What should I do to display the value correctly in the CSV
file?
Thanks for any help!
Mei 3 921
Are you sure the actual csv file is being outputted incorrectly? You said you opened it in excel, which will take your 000000 and make it into a 0 (that's just excel's problem), but if the csv file itself is ok, you are good to go. By the way, from a programming standpoint, always open csv files from a text editor, not excel, excel will change it around as you've found out!
"Mei Qin" <an*******@discussions.microsoft.com> wrote in message news:1c*****************************@phx.gbl... Hello, I have the following code to write each columns in a datarow to the csv file: myStreamWriter.Write(chr(34) & (myDr(I).ToString) & chr(34) & ",") I have a string field with the value of "000000". When I open the file in Excel, the value displayed as "0". But I really need to keep the way it is in the database. I tried the following: myStreamWriter.Write(chr(39) & (myDr(I).ToString) & ",") It displayed as "'000000". What should I do to display the value correctly in the CSV file? Thanks for any help! Mei
The customer need to open the CSV file in Excel, so they
can sort, filter on the data. -----Original Message----- Are you sure the actual csv file is being outputted
incorrectly? You said you opened it in excel, which will
take your 000000 and make it into a 0 (that's just excel's
problem), but if the csv file itself is ok, you are good
to go. By the way, from a programming standpoint, always
open csv files from a text editor, not excel, excel will
change it around as you've found out!
"Mei Qin" <an*******@discussions.microsoft.com> wrote in
message news:1c*****************************@phx.gbl... Hello,
I have the following code to write each columns in a datarow to the csv file: myStreamWriter.Write(chr(34) & (myDr(I).ToString) & chr
(34) & ",") I have a string field with the value of "000000". When
I open the file in Excel, the value displayed as "0". But
I really need to keep the way it is in the database. I
tried the following: myStreamWriter.Write(chr(39) & (myDr(I).ToString) & ",") It displayed as "'000000". What should I do to display the value correctly in the
CSV file?
Thanks for any help!
Mei .
Then in that case, you are probably going to need to surround all text values like this in quotes
"000000", "ABC", 45, 2837
"Mei Qin" <an*******@discussions.microsoft.com> wrote in message news:1c*****************************@phx.gbl... The customer need to open the CSV file in Excel, so they can sort, filter on the data. -----Original Message----- Are you sure the actual csv file is being outputted incorrectly? You said you opened it in excel, which will take your 000000 and make it into a 0 (that's just excel's problem), but if the csv file itself is ok, you are good to go. By the way, from a programming standpoint, always open csv files from a text editor, not excel, excel will change it around as you've found out!
"Mei Qin" <an*******@discussions.microsoft.com> wrote in
message news:1c*****************************@phx.gbl... Hello, I have the following code to write each columns in a datarow to the csv file: myStreamWriter.Write(chr(34) & (myDr(I).ToString) & chr (34) & ",") I have a string field with the value of "000000". When I open the file in Excel, the value displayed as "0". But I really need to keep the way it is in the database. I tried the following: myStreamWriter.Write(chr(39) & (myDr(I).ToString) & ",") It displayed as "'000000". What should I do to display the value correctly in the CSV file? Thanks for any help! Mei .
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: matt |
last post by:
I have compiled some code, some written by me, some compiled from
various sources online, and basically i've got a very simple flat file
photo gallery. An upload form, to upload the photos and give...
|
by: Dave Smithz |
last post by:
Hi There,
I have a PHP script that sends an email with attachment and works great when
provided the path to the file to send.
However this file needs to be on the same server as the script.
...
|
by: Joseph |
last post by:
Hi,
I'm having bit of questions on recursive pointer. I have following
code that supports upto 8K files but when i do a file like 12K i get a
segment fault. I Know it is in this line of code. ...
|
by: Zoury |
last post by:
Hi folks ! :O)
I'm trying to show a PDF in ASP.NET but I can't get to work properly.
here's a portion of my code :
'**
Dim ms As MemoryStream =...
|
by: Charles.Deisler |
last post by:
I'm reading a xmldocument in from the file system and using
xmldocument.writeto(xmltextwriter) to stream the xml data to the
response.outputstream. From what i've read, reading an xmldocument is...
|
by: StGo |
last post by:
How can i read/write file's custom attributs(like subject,author...) in
C#???
Thanks :))
|
by: Lokkju |
last post by:
I am pretty much lost here - I am trying to create a managed c++
wrapper for this dll, so that I can use it from c#/vb.net, however, it
does not conform to any standard style of coding I have seen....
|
by: Andy Fish |
last post by:
Hi,
I am using XmlDocument.WriteTo() and I find that the xml declaration is not
included.
at the moment I am doing this:
XmlTextWriter xw = new XmlTextWriter(...);
xw.WriteStartDocument();...
|
by: William |
last post by:
I am attempting to write an XmlDocument to file, but for some reason it will
only write 2048 characters of the document even though when I stop it in the
debugger ALL of the document is there.
...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
| |