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
Jump to Post
You 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 RepliesReply to this topic
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.