Sam123

Sam123

  • NA
  • 45
  • 2.3k

c# developement

Apr 2 2020 10:15 PM
Question - I got an error while debugging the program DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'SupportRepresentative'. Just check the database field also ID and Represenativename columns are present.  Please anyone help me for this.
  1. public void BindSupportActivity_Representativename()  
  2. {  
  3. try  
  4. {  
  5. using (SqlConnection sqlCon = new SqlConnection(@"Data Source=IN5CG9261RDP;Initial Catalog=TASKDETAILS;Trusted_Connection=True"))  
  6. {  
  7. {  
  8. sqlCon.Open();  
  9. string query = "select * from mRepresentative";  
  10. SqlDataAdapter sqladpt = new SqlDataAdapter(query, sqlCon);  
  11. DataTable dt = new DataTable();  
  12. sqladpt.Fill(dt);  
  13. SupportRepresentative.DataSource = dt;  
  14. SupportRepresentative.DataBind();  
  15. SupportRepresentative.DataTextField = "RepresentativeName";  
  16. SupportRepresentative.DataValueField = "ID";  
  17. SupportRepresentative.DataBind();  
  18. }  
  19. }  
  20. }  
  21. catch (Exception ex)  
  22. {  
  23. throw;  
  24. } 

Answers (3)