'Error:- External table is not in the expected format. OLEDB Connection String for CSV (Comma Delimited) file
I am getting getting when filling data into DataTable. This code is running absolutely fine for .xlsx file but i have to read data from .CSV file.
**I am getting Error when filling data into DataTable //sda1.Fill(dtBank) **
sting filePaths = "C:\ClientData\IDI\monitoring-20220426_out.csv";
constr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filePaths +
";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=1\"";
OleDbConnection con = new OleDbConnection(constr);
strtabName = Path.GetFileNameWithoutExtension(filePaths);
//strtabName = "monitoring-20220426_out";
OleDbCommand oconn1 = new OleDbCommand("Select * From [" + strtabName + "$]", con);
OleDbDataAdapter sda1 = new OleDbDataAdapter(oconn1);
dtBank = new System.Data.DataTable();
sda1.Fill(dtBank);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
