Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Binding an excel file to a DataGridView in C# and VS2005

Options
  • 27-06-2006 3:35pm
    #1
    Closed Accounts Posts: 29


    Hi I wish to display the data in an excel spread sheet in a DataGridView. I am coding in c# and using Visual Studio 2005. I have created a excel spread sheet called Excel Test. Then I add a DataGridView to my form and when it prompts me to add a new data source I select new connection. I then change the data source to Microsoft OBDC data source as it seems to be the only one that will allow me pick an excel file. I then change the user/ system file to Excel files and then I build the connection to point to the excel file, I then hit the test connection button and it produces a succesful test connection. I then ok to that and it directs me to choose Database objects. From a list it gives me the option of picking Tables, views, etc. I select all and then finish. But nothing appears in my gridview. In the option of picking my Database objects in the Tables section it does not expand so it seems that there is nothing in the excel speadsheet. I have got this working for both an access and sql database. I am setting it up correctly?


Comments

  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Of the top of my head you'll have to set up named ranges (at least one) within the spreadsheet and select from them instead of your traditional database table names.


Advertisement