title: Why DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'xxx'?
body: <p>I am importing data from excel sheet but it works for one sheet but not another with the same columns and correct data. It works for many files but not few. I have attached the samples and error below with code. At bind, it throws error.</p>
  
  <p>The sheet that is working:</p>
  
  <p><a href="https://i.stack.imgur.com/mok7M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mok7M.png" alt="enter image description here"></a></p>
  
  <p>and the sheet that is causing the error:</p>
  
  <p><a href="https://i.stack.imgur.com/8FeM0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8FeM0.png" alt="enter image description here"></a></p>
  
  <p>Error:</p>
  
  <p><strong>DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Amount'.</strong></p>
  
  <p>Code:</p>
  
  <pre><code>private void ImportDataToGrid(string FilePath, string Extension, string isHDR)
      {
          string conStr = "";
          switch (Extension)
          {
              case ".xls": //Excel 97-03
                  conStr = ConfigurationManager.ConnectionStrings["Excel07ConString"].ConnectionString;
                  break;
              case ".xlsx": //Excel 07
                  conStr = ConfigurationManager.ConnectionStrings["Excel07ConString"].ConnectionString;
                  break;
          }
          conStr = String.Format(conStr, FilePath, isHDR);
          OleDbConnection connExcel = new OleDbConnection(conStr);
          OleDbCommand cmdExcel = new OleDbCommand();
          OleDbDataAdapter oda = new OleDbDataAdapter();
          DataTable dt = new DataTable();
          cmdExcel.Connection = connExcel;
  
          //Get the name of First Sheet
          connExcel.Open();
          DataTable dtExcelSchema;
          dtExcelSchema = connExcel.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
          string SheetName = dtExcelSchema.Rows[0]["TABLE_NAME"].ToString();
          connExcel.Close();
  
          //Read Data from First Sheet
          connExcel.Open();
          cmdExcel.CommandText = "SELECT * From [" + SheetName + "]";
          oda.SelectCommand = cmdExcel;
          oda.Fill(dt);
          connExcel.Close();
          DataColumn dc = new DataColumn("NITNo", typeof(string));
          dc.DefaultValue = txtNitNo.Text.ToString();
          dt.Columns.Add(dc);
  
          dc = new DataColumn("WorkNo", typeof(string));
          dc.DefaultValue = txtWorkNo.Text.ToString();
          dt.Columns.Add(dc);
  
          //Bind Data to GridView
          gvBOQ.Caption = Path.GetFileName(FilePath);
          gvBOQ.DataSource = dt;
          gvBOQ.DataBind();
      }
  </code></pre>
  
  <p>GV:</p>
  
  <pre><code>&lt;asp:GridView ID="gvBOQ" runat="server" AutoGenerateColumns="false" EmptyDataText="No Data Found"
      CssClass="table table-responsive table-bordered table-striped"&gt;
      &lt;Columns&gt;
          &lt;asp:TemplateField HeaderText="S.No"&gt;
              &lt;ItemTemplate&gt;
                  &lt;%# Container.DataItemIndex+1 %&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="NIT No"&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Literal ID="liNITNo" runat="server" Text='&lt;%#Eval("NITNo") %&gt;' /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="Work No"&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Literal ID="liWorkNo" runat="server" Text='&lt;%#Eval("WorkNo") %&gt;' /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="Item Code"&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Literal ID="liItemCode" runat="server" Text='&lt;%#Eval("ItemCode") %&gt;' /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="Item Description"&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Literal ID="liItemDesc" runat="server" Text='&lt;%#Eval("DescriptionOfItem") %&gt;' /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="Quantity"&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Literal ID="liQuantity" runat="server" Text='&lt;%#Eval("Quantity") %&gt;' /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="Unit"&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Literal ID="liUnit" runat="server" Text='&lt;%#Eval("Unit") %&gt;' /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="Rate"&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Literal ID="liRate" runat="server" Text='&lt;%#Eval("Rate") %&gt;' /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="Amount"&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Literal ID="liAmount" runat="server" Text='&lt;%#Eval("Amount") %&gt;' /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
      &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  </code></pre>