我从excel表导入数据时遇到问题,我有32列,但是当我填写DataTable时,它只带了19列。是否有列的限制
我的代码是:
using (OleDbConnection con = new OleDbConnection(conStr))
{
using (OleDbCommand cmd = new OleDbCommand())
{
using (OleDbDataAdapter oda = new OleDbDataAdapter())
{
DataTable dt = new DataTable();
cmd.CommandText = "SELECT * From [" + sheetName + "]";
cmd.Connection = con;
con.Open();
oda.SelectCommand = cmd;
oda.Fill(dt);
con.Close();
//lleno el DataGridView.
grdExcel.DataSource = dt;
}
}
}