anjumathi kumar

anjumathi kumar

  • NA
  • 54
  • 64.2k

how to import data from excel to grid

Aug 11 2011 2:59 AM
Hi
How to import data from Microsoft Excel 2010 to Gridview

am using web application.(visual studio 2010)

  String strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=D:\\Book1.xls;" + "Extended Properties=Excel 8.0;HDR=NO;";
                DataTable ds = new DataTable();
                string strSQL = "SELECT * FROM [Sheet1$]";
                OleDbDataAdapter da = new OleDbDataAdapter(strSQL, strConn);
                da.Fill(ds);
                grvPatient.DataSource = ds;
                grvPatient.DataBind();

m trying like this it provide error

Answers (4)