We have to create a excel as a database.
Step 1 : Open Excel sheet and enter data's
Step 2 : Select the data's which u want.
Step 3 : Click Insert tab->Name->Define
Step 4 : Give the name for the selected data's
pgeExcel.cs
Now we display the excel database in a gridview which we created.
OleDbDataAdapter da;
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
data source=f:/Book1.xls;Extended Properties=Excel 8.0;");
con.open();
da = new OleDbDataAdapter("select * from emp", con);//emp is the name given in excel sheet
DataSet ds=new DataSet();
da.Fill(ds,"emp");
GridView1.DataSource=ds;
GridView1.DataBind();
Copy Data From Excel to GridView
Posted by
Geeks
Labels:
Asp.net
Subscribe to:
Post Comments (Atom)
Post a Comment