Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted (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 by Machaira
Here's what I'm up to.
Posted

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!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...