Solved

Export from vb.net to csv file

Posted on 2013-06-05
4
480 Views
Last Modified: 2013-06-06
Does anyone know how to export the results of a query to a csv file in vb.net 4.0?

Thanks
0
Comment
Question by:ajdarlow
4 Comments
 
LVL 4

Assisted Solution

by:MrC63
MrC63 earned 250 total points
ID: 39223117
The File System Object (fso) is one way to do it.  See the following link:

http://msdn.microsoft.com/en-us/library/aa711216%28v=vs.71%29.aspx
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 39224748
can u post the code u use to query the results?
are you getting datatable/dataset as results or datareader?
0
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 250 total points
ID: 39225203
0
 

Author Closing Comment

by:ajdarlow
ID: 39225269
Thanks guys.

In the end I used the following


        My.Computer.FileSystem.DeleteFile(strFileName)

        mySqlDataAdapter.Fill(myDataSet, "Tags")
        For Each myDataRow In myDataSet.Tables("Tags").Rows
            strText = myDataRow("TagId") & ", " & myDataRow("TagDesc") & vbCrLf
            My.Computer.FileSystem.WriteAllText(strFileName, strText, True)
        Next myDataRow
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now