Excel中的数据
a b
21 45
c d
3 4
但是在Datagridview中只有
a   b(这行是列名)
21  45
         (这行为何空掉了啊,没有显示c d)????????????
3   4
怎样把c  d在Datagridview也显示出来啊,
我将这些数据插入到SQL2000后显示
21    45
null  null
3     4
代码如下:
public  DataSet ds;
  public  DataTable dt;
string str = "Data Source=localhost;Initial Catalog=excel;Integrated Security=True";
            string strCon = " Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source =C:\\1.xls;Extended Properties=Excel 8.0";
            OleDbConnection conn = new OleDbConnection(strCon);
            string sql = "select * from [Sheet1$]";
            conn.Open();
            OleDbDataAdapter myCommand = new OleDbDataAdapter(sql, strCon);
            ds = new DataSet();
            myCommand.Fill(ds, "[Sheet1$]");
            dataGridView1.DataMember = "[Sheet1$]";
            dataGridView1.DataSource = ds;
            conn.Close();
           SqlBulkCopy DesBulkOp = new SqlBulkCopy(str);  
            dt = ds.Tables[0] ;
            if (dt!= null&&dt.Rows.Count!=0)
            {
                try
                {
                    DesBulkOp.DestinationTableName = "Table1";
                    DesBulkOp.WriteToServer(dt);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    DesBulkOp.Close();
                }
                MessageBox.Show("恭喜你,插入成功!");