Hi,
You can use the following VB.NET code (via
Spire.DataExport, a Free Data Export Component):
Private Sub btnText_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnText.Click
Dim oleDbConnection1 As New System.Data.OleDb.OleDbConnection()
oleDbConnection1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\..\..\..\Database\demo.mdb"
Dim oleDbCommand1 As New System.Data.OleDb.OleDbCommand()
oleDbCommand1.CommandText = "select * from parts"
oleDbCommand1.Connection = oleDbConnection1
Dim txtExport1 As New Spire.DataExport.TXT.TXTExport()
txtExport1.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView
txtExport1.DataFormats.CultureName = "zh-CN"
txtExport1.DataFormats.Currency = "c"
txtExport1.DataFormats.DateTime = "yyyy-M-d H:mm"
txtExport1.DataFormats.Float = "g"
txtExport1.DataFormats.[Integer] = "g"
txtExport1.DataFormats.Time = "H:mm"
txtExport1.DataEncoding = Spire.DataExport.Common.EncodingType.ASCII
txtExport1.SQLCommand = oleDbCommand1
oleDbConnection1.Open()
txtExport1.ExportType = Spire.DataExport.TXT.TextExportType.SYLK
txtExport1.FileName = "sample.slk"
txtExport1.SaveToFile()
txtExport1.ExportType = Spire.DataExport.TXT.TextExportType.CSV
txtExport1.FileName = "sample.csv"
txtExport1.SaveToFile()
txtExport1.ExportType = Spire.DataExport.TXT.TextExportType.DIF
txtExport1.FileName = "sample.dif"
txtExport1.SaveToFile()
txtExport1.ExportType = Spire.DataExport.TXT.TextExportType.TXT
txtExport1.FileName = "sample.txt"
txtExport1.SaveToFile()
End Sub