Hello, I'm new to vb.net. I have successfully run a simple sql query in vb.net and basically wanted to know how I can export the results from the query to a .txt file? All I really know is that I should be using StreamWriter. Does anyone have suggestions for sending, for example "SELECT column1, column2, from table1 where column1 = '1'" to a .txt file? Would it be best to first bind the data to a grid or can I skip that step? Thanks in advance
smd5049
0
Newbie Poster
Recommended Answers
Jump to PostYou can use a select statement to fill a DataSet/DataTable. You can then export the entire dataset to an xml file with a single call, youDataSet.WriteXml(strYourFileNameAndPath)
Exporting to a text file is a bit more involved, you have to loop thru each of the records in the datatable to …
All 6 Replies
TomW
73
Posting Whiz
hjdaniel.sun
0
Newbie Poster
smd5049
0
Newbie Poster
smd5049
0
Newbie Poster
smd5049
0
Newbie Poster
Satyam Kr. Jha
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.