I have a little problem with the following code. The code works fine if I do not enable HDR = NO. The CSV that will be used for this WEB application will not have header information. How can I read it in a dataset and create static column names?
I get this error when running the code below:
Could not find installable ISAM.
Here is my code:
FileUpload1.SaveAs(System.IO.Path.Combine(target, FileUpload1.FileName));
string connString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Text; HDR=NO;", System.IO.Path.GetDirectoryName(target + "\\" + FileUpload1.FileName));
string cmdString = string.Format("SELECT * FROM {0}", System.IO.Path.GetFileName(target + "\\" + FileUpload1.FileName));
OleDbDataAdapter dataAdapter = new OleDbDataAdapter(cmdString, connString);
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet);
GridView1.DataSource = dataSet.Tables[0];
GridView1.DataBind();
I would be grateful for any help.
Thank.
Steve source
share