Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 883031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:31:13+00:00 2026-05-15T12:31:13+00:00

Using VS2005 with C# I want to fill the combobox by using the table

  • 0

Using VS2005 with C#

I want to fill the combobox by using the table value.

Code

OdbcConnection con = new OdbcConnection();
    OdbcCommand cmd;

con.ConnectionString =                            "";
        con.Open();
        cmd = new OdbcCommand("Select no from table", con);
        ada = new OdbcDataAdapter(cmd);
        ds = new DataSet();
        ada.Fill(ds);
        combobox1.Items.Add(ds);

But no values was loading in the combobox, what wrong with my above mentioned code.

can any provide a solution for the probelm….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T12:31:13+00:00Added an answer on May 15, 2026 at 12:31 pm

    You do have something in your real connection string, right?

    You’re loading your data into a DataSet – that’s a collection of tables and relations. How should the combobox know what table’s data to display?? If the DataSet has multiple tables in it, you would have to additionally define which one of those to use. If the DataSet has only one table inside, then it’s a waste of resources to use a DataSet in the first place.

    If you only have a single set of data, use a DataTable instead:

    con.Open();
    cmd = new OdbcCommand("Select no from table", con);
    ada = new OdbcDataAdapter(cmd);
    DataTable data = new DataTable();
    ada.Fill(data);
    
    // define the column to be used to display text in the combobox
    combobox1.DataTextField = "FirstName";
    // define the column to be used as the value for the selection in the combobox
    combobox1.DataValueField = "CustomerID";
    
    combobox1.DataSource = data;
    combobox1.DataBind();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using VS2005 C# ASP.NET 2.0. I want to know where can I
I am using ASP.NET C# on VS2005. I have a GridView table with a
I am using VS2005 C# and SQL Server 2005. I want to form an
HI all, Iam using VS2008 and SQL2008 i want to access my stored procedures
Using C# and WinForms in VS2008, I want to create a file browser control
I'm using VS2005 and the MS implementation of STL. However, the class type_info in
I have a Windows 7 machine on which I am using VS2005. .Net 2.0
I have developed a window application in VS2005 using C#. I need to integrate
I'm developing a Windows application in VS2005 using C#. In my project, I generate
I am using treeview in C# and VS2005 if ((tempnode1 = tempnode1.NextVisibleNode) != null);

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.