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

  • Home
  • SEARCH
  • 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 6070931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:59:21+00:00 2026-05-23T09:59:21+00:00

Hi I have a small problem. I am coding a program that displays the

  • 0

Hi I have a small problem. I am coding a program that displays the columns of an Excel file file and next to it the columns of an Access database in two seperate listviews. You select the sheet and table to display with a combo box. The Access columns display fine but the columns of the Excel sheet won’t display no matter what I do but the sheets appear in the combo box without any problems but the columns won’t appear no matter what I do. Is there any specific way that I can do this that works because I couldn’t find anything on the Internet.

This is the part that is supposed to insert it
{

             {

            // lvwDestination.Columns.Add(_dt.Columns[i].ColumnName);

            lvwSource.Columns.Add("Fields in Database", -2, HorizontalAlignment.Left);

            for (int i = 0; i < _Sourcedt.Rows.Count; i++)
            {

                ListViewItem lvwItem = new ListViewItem("" + _Sourcedt.Columns[i].ColumnName, 0);
                lvwSource.Items.AddRange(new ListViewItem[] { lvwItem });

            }


        }

    }

Another part also that I may have messed up it worked for access but not for excel. I also modified the Select statement little

private void cboSourceName_SelectedIndexChanged(object sender, EventArgs e)
{
// create the adapter and fill the DataSet

        OleDbDataAdapter adapter =
           new OleDbDataAdapter("Select * from " + cboSourceName.Text +"" + "", _SourceConn);
        lvwSource.Columns.Clear();

        lvwSource.Items.Clear();

        _Sourcedt.Columns.Clear();//Contains all the columns in selected table

        try
        {
            adapter.Fill(_Sourcedt);
        }
        catch
        {
        }
        LoadColumns2();

    }

And also the connect part

private void btnConnectSource_Click(object sender, EventArgs e)
{
try
{

            string connString =



            "Provider=Microsoft.Jet.OLEDB.4.0;" +
            "Data Source=" + txtSourcePath.Text + ";" +
            "Extended Properties=Excel 8.0";
            //"Password=" + txtPWSource + ";";

            _SourceConn = new OleDbConnection(connString);
           // _OleConn[1].ConnectionString = connString;
            _SourceConn.Open();

            _Sourcedt = new DataTable();

            LoadCombo2();
        }

        catch (Exception ex)
        {
            MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
  • 1 1 Answer
  • 3 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-23T09:59:22+00:00Added an answer on May 23, 2026 at 9:59 am

    Listview is not a great idea to use in this case. The best way to do it is to populate your data from Excel into a Datagrid

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small problem here and hope that someone can help me out.
Hello i´m coding in C# and have a problem. I have two Forms (Form1
I have a small problem that I want to load a url in web
I have small problem with my .net 2.0 winforms application. I want to embed
I have a small problem with interfaces. Here it is in Pseudo code :
I have a small problem with a script. I want to have a default
I have a small problem with how should i think a... problem. I want
SQL to find duplicate entries (within a group) I have a small problem and
I have a small math problem I am trying to solve Given a number
I'm having a small problem in Java. I have an interface called Modifiable. Objects

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.