Psygnus Posted July 25, 2005 Posted July 25, 2005 Hello everybody i would like some help for the following issue: I want to populate a ComboBox with values from an Access DB Table everytime it initializes. I 've done all the connections right(datasets,adapters etc...). I have written the following code which i got from the .NET Help but it doesn't work: this->comboBox1->DataSource = this->dataSet41->Clientz; this->comboBox1->DisplayMember = S"Name"; There are no errors but no results too! Please Help Thanks in advance Quote
Machaira Posted July 25, 2005 Posted July 25, 2005 (edited) Does the table actually have rows in it? What is "Clientz"? Is the column name "Name" correct (is it actually "name")? The following works just fine for me: DataTable *dt = new DataTable(); sqlDataAdapter1->Fill(dt); comboBox1->DataSource=dt; comboBox1->DisplayMember="Name"; comboBox1->ValueMember = "ID"; Edited July 25, 2005 by Machaira Quote Here's what I'm up to.
Psygnus Posted July 25, 2005 Author Posted July 25, 2005 Oh..! I never thought of using a DataTable! I thought that creating a dataSet can be a way to access directly database fields. But now i understand that it's only used to avoid writing all the update statements on your own. Or not!!!?? :confused: The point is that it's working just fine now!! :) :) THANKS A LOT! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.