这是我在项目中使用的代码:
private void button1_Click(object sender, EventArgs e)
{
OleDbConnection conn = new OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0; Data Source=C:\KursniListi.xlsx" + @";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1;ImportMixedTypes=Text;TypeGuessRows=0""";
OleDbCommand command = new OleDbCommand
(
"SELECT *" +
"FROM [Sheet1$]", conn
);
DataSet dsKL = new DataSet();
OleDbDataAdapter adapter = new OleDbDataAdapter(command);
adapter.Fill(dsKL);
dataGridView1.DataSource = dsKL.Tables[0];
}
http://uploadpic.org/v.php?img=j8nn3BtVP2
我需要这个来显示我:第 1 行和第 11 行,C、E、F 列