Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
c# code for how to insert total excel coloumn in database
Posted
Comments
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

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


after that use the table ds to fill your datatable
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900