C#读取EXCEL数据到DataSet
代码如下:
public DataSet ExcelToDS(string Path)
        {
           string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Path + ";" + "Extended Properties='Excel 8.0;HDR=No;IMEX=1'";
           OleDbConnection conn = new OleDbConnection(strConn);
           conn.Open(); 
           string strExcel = "";   
           OleDbDataAdapter myCommand = null;
           DataSet ds = null;
           strExcel="select * from [Sheet1$]";
           myCommand = new OleDbDataAdapter(strExcel, strConn);
           ds = new DataSet();
           myCommand.Fill(ds);
           return ds;
        }
但是调用后不报异常,ds为空.怎么回事?????
Excel数据如下:
1 zhangsan shenzhen
2 lishi guangzhou