DataSet Binding Question

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";
 
J

John

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top