1

enter image description here

I have Excel Data Like above. Whenever i trying to get the value as 12/1/2015. I used to get 1-Dec,2-Dec etc Like this image

DataSet Visualizer

 bool hasHeaders = true;
        string HDR = hasHeaders ? "Yes" : "No";
        string strConn;
        if (path.Substring(path.LastIndexOf('.')).ToLower() == ".xlsx")
            strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=\"Excel 12.0 Xml; HDR =" + HDR + ";IMEX=1;TypeGuessRows=0;ImportMixedTypes=Text\"";
        else
            strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Extended Properties=\"Excel 8.0;HDR=" + HDR + ";IMEX=1;TypeGuessRows=0;ImportMixedTypes=Text\"";

retrieving the data from Excel.

  OleDbDataAdapter dataHeader = new OleDbDataAdapter("SELECT  * FROM [" + sheet + Coords + "]", Connection);
            dataHeader.Fill(tableHeader);

please find the mistake.

vinodh
  • 714
  • 1
  • 7
  • 20

0 Answers0