想要把excel导入数据库,但又没办法去掉下面那么多空行。
求教我该怎么做?string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + excelFile + ";" + "Extended Properties=Excel 8.0;";   
OleDbConnection conn = new OleDbConnection(strConn);   
conn.Open();   
string strExcel = "";   
OleDbDataAdapter myCommand = null;
strExcel = string.Format("select * from [{0}$]", sheetName);   
myCommand = new OleDbDataAdapter(strExcel, strConn);   
myCommand.Fill(ds, sheetName);

解决方案 »

  1.   

    加条件查询,select * from [{0}$] where ** is not null(还是not is null 来着?)
      

  2.   

    这样好像不行   要导入的excel不确定,列数,列名事先都不知道
      

  3.   

    我在WebBase的程序是这样做的:Insert之前检查整行的数据是否符合规范,
      

  4.   

    有什么方法可以取excel数据的时候就一次性把空行去掉吗?
      

  5.   

    我以前写过一个程序,可以把excel导入界面很灵活。
    明天我找一下,