Click here to Skip to main content
12,698,686 members (27,953 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#
c# code for how to insert total excel coloumn in database
Posted 27-Dec-12 0:39am
Oleksandr Kulchytskyi 27-Dec-12 5:54am
What do you mean ???
Total count of collumns on one sheet??
Or all columns (it's name )???
IpsitaMishra 27-Dec-12 6:07am
I thought you want to insert all the column(and daterows) of excel sheet to one of the table in the your db .Is it :)

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Try this it may help you
string connectionString = GetConnectionString();
                        OleDbConnection connection = new OleDbConnection(connectionString);
                        OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM [Sheet2$]", connection);
                        DataTable dtImprtExcel = new DataTable();

after that use the table ds to fill your datatable

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170118.1 | Last Updated 27 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100