I'm using .net4.0 and c# language. In my code i have a connection string
oleConnection.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;
Data Source = " + filepath + ";
Extended Propertie s= \"Excel 12.0;HDR=yes\"";
and it work well. But when i change a connection string l开发者_运维百科ike this:
oleConnection.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;
Data Source =" + filepath + ";
Extended Properties =\"Excel 12.0;HDR=no\"";
(I change HDR parameter for "no")
I got error: No value given for one or more required parameters.
error from "Microsoft Office Access Database Engine".
If your referencing a column using say [A1] then this will fail. With HDR=No the columns are referenced as F1, F2 etc.
OleDb Connection HDR Default is YES ans there is no option for that.
Check:
Connection strings for Access 2007
Regards
There is no HDR=no
....
The default behavioour is no headers. So just leave out the HDR part completely - that will also mean no headers.
More info: http://msdn.microsoft.com/en-us/library/ms254500.aspx
精彩评论