title: Conversion failed when converting the nvarchar value 'System.Data.DataRowView' to data type int
body: <p>I am trying to populate a <code>DataGridView</code> based on a comboBox selection. I don't know where I am going wrong - please help.. </p>
  
  <p>Here is my code:</p>
  
  <pre><code>public void GetTestGroups()
  {
      string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
  
      using (SqlConnection con = new SqlConnection(CS))
      {
          SqlDataAdapter da = new SqlDataAdapter("select LabTestGroupId,GroupName from tbl_LabTestGroup", con);
          DataTable dt = new DataTable();
          da.Fill(dt);
  
          cbTestGroup.DataSource = dt;
          cbTestGroup.DisplayMember = "GroupName";
          cbTestGroup.ValueMember = "LabTestGroupId";           
      }
  }
  
  private void cbTestGroup_SelectedIndexChanged(object sender, EventArgs e)
  {
      string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
  
      using (SqlConnection con = new SqlConnection(CS))
      {
          SqlDataAdapter da = new SqlDataAdapter("spGetTestNames", con);
          da.SelectCommand.CommandType = CommandType.StoredProcedure;
  
          da.SelectCommand.Parameters.AddWithValue("@LabTestGroupId", cbTestGroup.SelectedValue.ToString());
  
          DataTable dt = new DataTable();
          da.Fill(dt);// Error in this line.
  
          dgvLabTests.DataSource = dt;
      }
  }
  </code></pre>
  
  <p>My stored procedure:</p>
  
  <pre><code>create procedure spGetTestNames 
      @LabTestGroupId int
  as
  begin 
      select TestNames 
      from tbl_LabTests 
      where LabTestGroupId = @LabTestGroupId
  end
  </code></pre>