problem when exporting sql db to csv/txt file

D

Dan

Hi,

i have some problem with exporting data from sql server to some formats.
Excel and Word are not a problem, but .txt and .csv do not work properly:
- with .txt, the data are shown (correctly) in the browser but the windows
asking to save or to open the file never appears.
- with .csv, the code below produces an identical excel file as with.xls (no
comma).

Here an extract of the code:

Dim objFileStream As FileStream
Dim objStreamWriter As StreamWriter
....
filecsv = "myfile".xls" '=> this is ok
'filecsv = "myfile".csv" => this produces an excel file just like .xls
'filecsv = "myfile".doc" => this is ok (word file)
'filecsv = "myfile".txt" => this produces no file (windows asking to save or
to open never appears)
' but instead the data are automatically rendered correctly in the browser
....
objFileStream = New FileStream(fileName, FileMode.OpenOrCreate,
FileAccess.Write)
objStreamWriter = New StreamWriter(objFileStream)
....
objStreamWriter.WriteLine(strLine)
....

Do i have to manipulate some parameters in some functions?
Thanks for tips.
Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top