Friday, July 31, 2009

Reading Excel, Date Value become Null orBlank

sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strValue + ";Extended Properties=\"Excel 8.0;HDR=NO\"";

cn.ConnectionString = sConnectionString;

cn.Open();

string sSQL = "SELECT * FROM [Sheet1$]";
OleDbCommand cmd = cn.CreateCommand();
cmd.CommandText = sSQL;
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
da.Fill(excelList);
dataGridView1.DataSource = excelList;

---------------------------------------------------------------------------------
Hi everyone,
I have the above code to call a excel, but when the field is a date and the vaue is also a date, there is nothing to show in my datagridview... it is not showing the 5 digit date value either.....

No comments:

Post a Comment

Followers