problem when exporting sql db to csv/txt file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dan

    #1

    problem when exporting sql db to csv/txt file

    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".xl s" '=this is ok
    'filecsv = "myfile".cs v" =this produces an excel file just like .xls
    'filecsv = "myfile".do c" =this is ok (word file)
    'filecsv = "myfile".tx t" =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(file Name, FileMode.OpenOr Create,
    FileAccess.Writ e)
    objStreamWriter = New StreamWriter(ob jFileStream)
    ....
    objStreamWriter .WriteLine(strL ine)
    ....

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


Working...