Retrieving Large Amounts of Data From a Dataset and Writing to a File
Can anyone recommend a better way of writing a huge amount of data stored in a dataset, into a text file (has to be comma delimited).
Thanks in advance.
Can anyone recommend a better way of writing a huge amount of data stored in a dataset, into a text file (has to be comma delimited).
Thanks in advance.
ADO.Net provides the functionallity to connect directly to textfiles:
| OLE DB | |||
| Delimited columns | |||
| |||
| Fixed length columns | |||
| |||
| |||
Ravman,
Use the FileSystem.Print method that writes display-formatted data to sequential file. The following code is an example that uses the Print and PrintLine functions to write data to a file:
FileOpen(1, "c:\trash.txt", OpenMode.Output)' Open file for output.
Print(1, "This is a test.")' Print text to file.
PrintLine(1)' Print blank line to file.
PrintLine(1, "Zone 1", TAB(), "Zone 2")' Print in two print zones.
PrintLine(1, "Hello", "World")' Separate strings with a tab.
PrintLine(1, SPC(5), "5 leading spaces ")' Print five leading spaces.
PrintLine(1, TAB(10), "Hello")' Print word at column 10.
' Assign Boolean, Date, and Error values.
Dim aBool As Boolean
Dim aDate As DateTime
aBool = False
aDate = DateTime.Parse("February 12, 1969")
' Dates and booleans are translated using locale settings of your system.
PrintLine(1, aBool, " is a Boolean value")
PrintLine(1, aDate, " is a date")
FileClose(1)' Close file.
Read the following link to get more help:
http://msdn2.microsoft.com/en-gb/library/microsoft.visualbasic.filesystem.print.aspx