DataSet Binding Question

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi,

I am having problems with binding a dataset to a combo box. I have created
an query in Access 2002 called procModels. I want to be able to call it and
retrieve the data from the query. I have included some code below. Any
help will be appreciated.

sql = "EXECUTE procModels";
OleDbConnection dbConn = new OleDbConnection(connString);
OleDbDataAdapter dbAdapter = new OleDbDataAdapter(sql, dbConn);
DataSet ds = new DataSet();
dbAdapter.Fill(ds, "tblModels");
return ds;

databinding code:
this.modelComboBox.DataSource = ds.Tables["tblModels"];

Thanks in adavance
this.modelComboBox.DisplayMember = "tblModels.strCode";
 
Nevermind I figured it out. In the code 'this.modelComboBox.DisplayMember =
"tblModels.strCode"' it was wrong I did not need to specify the tbl name.
 
Back
Top