.Dat file to dataset

1k Views Asked by At

I have a .dat file that I need to import into a datatable. I am using .net framework 4.5 and it delimited by ~. How do I import this? I tried

string mySelectQuery = "SELECT * FROM " + fileName;
OleDbConnection myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;DataSource=" + fileLocation + ";Extended Properties=\"text;HDR=YES;FMT=Delimited\"");
OleDbDataAdapter dsCmd = new OleDbDataAdapter(mySelectQuery, myConnection);
//Fill the DataSet object
dsCmd.Fill(myData, "Packets");

Please help

0

There are 0 best solutions below