98fatboyrider
asked on
Populating a combobox with values from SQL database
I need to populate a combobox with values from a dataset. When running the code below, I recieve "Cannot bind to the new display member.Parameter name: newDisplayMember". Any suggestions?
DAL rating = new DAL();
DataSet ds = rating.getRatings("SELECT * FROM tblRating");
cboRating.DataSource = ds;
cboRating.DisplayMember = "Rating"; //Colunm name for display
cboRating.ValueMember = "RatingID"; //Primary key <----Error here
DAL rating = new DAL();
DataSet ds = rating.getRatings("SELECT * FROM tblRating");
cboRating.DataSource = ds;
cboRating.DisplayMember = "Rating"; //Colunm name for display
cboRating.ValueMember = "RatingID"; //Primary key <----Error here
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.