Click here to Skip to main content
16,021,464 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to Insert Datas in Microsoft Excel to DataGridView in Windows Application Using c#
Posted
Updated 29-Dec-11 23:34pm
v2

Look it

string connstr ="Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\aaa.xls;Extended Properties=Excel 8.0"/>
        OleDbConnection conn = new OleDbConnection(connstr);
        string strSQL = "SELECT * FROM [Sheet$]";

        OleDbCommand cmd = new OleDbCommand(strSQL, conn);
        DataSet ds = new DataSet();
        OleDbDataAdapter da = new OleDbDataAdapter(cmd);
        da.Fill(ds);
        GridView1.DataSource = ds;
        GridView1.DataBind();
 
Share this answer
 
You already received answers to this question here[^]. Please do not repost the same question but edit your original.
 
Share this answer
 
 
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