CSV Reports
CsvFileToDataTable Method
Example 



KellermanSoftware.CsvReports Namespace > CsvReader Class : CsvFileToDataTable Method
A fully qualified file path
Read a CSV file into a DataTable. There must be a header row and the column names must be alpha numeric.
Syntax
Public Function CsvFileToDataTable( _
   ByVal filePath As String _
) As DataTable
Dim instance As CsvReader
Dim filePath As String
Dim value As DataTable
 
value = instance.CsvFileToDataTable(filePath)
public DataTable CsvFileToDataTable( 
   string filePath
)
public:
DataTable^ CsvFileToDataTable( 
   String^ filePath
) 

Parameters

filePath
A fully qualified file path
Example
CsvReader csvReader = new CsvReader(); //Trial Mode
//CsvReader csvReader = new CsvReader("place user name here", "place license key here"); //License Mode
 
//Create a test file
string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testReader.csv");
File.WriteAllText(filePath, "Name,Birthdate\r\nJohn,5/30/2013");
 
DataTable results = csvReader.CsvFileToDataTable(filePath);
Dim csvReader As New CsvReader() 'Trial Mode
'Dim csvReader As New CsvReader("place user name here", "place license key here") 'License Mode
 
'Create a test file
Dim filePath As String = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testReader.csv")
File.WriteAllText(filePath, "Name,Birthdate" & vbCrLf & "John,5/30/2013")
 
Dim results As DataTable = csvReader.CsvFileToDataTable(filePath)
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

CsvReader Class
CsvReader Members