title: No mapping exists from object type System.Data.DataRowView to a known managed provider native type when inserting data to a table
body: <p>I have a comboBox in which data are loaded from a table containing Id as primary key and a unique name and data loaded inside comboBox in Load event , now when I'm trying to insert the data into a table it gives me the exception as declared in the question and the exception appearing in the line:  </p>
  
  <pre><code>cmd.ExecuteNonQuery();  
  </code></pre>
  
  <p>I tried the solution provided in this link but it gives me the same exception<br>
  <a href="https://stackoverflow.com/questions/18929481/error-no-mapping-exists-from-object-type-system-data-datarowview-to-a-known-ma">ERROR : No mapping exists from object type System.Data.DataRowView to a known managed provider native type</a></p>
  
  <p>This is my Load event codes:  </p>
  
  <pre><code>try
  {
     if (cn.State == ConnectionState.Closed)
     {
         cn.Open();
     }
     SqlDataAdapter da = new SqlDataAdapter("select Id,name from carsCostsFor", cn);
     DataTable dt = new DataTable();
     da.Fill(dt);
     carCostsCmbo.DataSource = dt;
     carCostsCmbo.ValueMember = "Id";
     carCostsCmbo.DisplayMember = "name";
  }
  catch (SqlException ex)
  {
       MessageBox.Show(ex.Message);
  }  
  </code></pre>
  
  <p>And this is the save button codes:  </p>
  
  <pre><code> try
   {
      if (cn.State == ConnectionState.Closed)
      {
          cn.Open();
      }
      SqlCommand cmd = new SqlCommand("insert into carsCosts (Id,costId,costFor,costDate,costAmount,costNotes) values (@id,@cId,@for,@date,@amount,@notes)", cn);
      cmd.Parameters.AddWithValue("@id", id);
      cmd.Parameters.AddWithValue("@cId", carCostsCmbo.SelectedValue);
      cmd.Parameters.AddWithValue("@for", carCostsCmbo.SelectedItem);
      cmd.Parameters.AddWithValue("@date", carCostsDateDtp.Value);
      cmd.Parameters.AddWithValue("@amount", carCostsAmountTxt.Text.Trim());
      cmd.Parameters.AddWithValue("@notes", carCostsNotesRichTxt.Text.Trim());
      cmd.ExecuteNonQuery();
      MessageBox.Show("تم حفظ البيانات بنجاح");
  }
  catch (SqlException ex)
  {
     MessageBox.Show(ex.Message);
  }
  </code></pre>