hi Friends
i am sending the code please check it...
please dont share me any link once check this and tell me where i did mistake..
design page///
GridView with Excel File
code///
protected void btnupload_click(object sender, EventArgs e)
{
string connString = "";
string strFileType = Path.GetExtension(fileupload1.FileName).ToLower();
string path = fileupload1.PostedFile.FileName;
if (strFileType.Trim() == ".xls")
{
connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= D:\\Bio Rad\\exceldata.xlsx ;Extended Properties=\"Excel 8.0\"";
// connString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source= D:\\Bio Rad\\exceldata.xlsx;Extended Properties=\"Excel 12.0 ;HDR=YES\"";
}
string query = "Select [Patient ID],[Assay],[Well],[Flag],[Value],[S/CO],[Result] from Exceldata";
OleDbConnection conn = new OleDbConnection(connString);
if (conn.State == ConnectionState.Closed)
conn.Open();
OleDbCommand cmd = new OleDbCommand(query, conn);
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
gvexcel.DataSource = ds.Tables[0];
gvexcel.DataBind();
da.Dispose();
conn.Close();
conn.Dispose();
}
}
Rajeesh MenothPosted Aug 17, 2015, 1:09 AM
Satinder SinghPosted Aug 20, 2015, 3:43 AM
Rajeesh MenothPosted Aug 17, 2015, 1:39 AM
anjali khanPosted Aug 17, 2015, 1:06 AM
Hemlata KushwahaPosted Aug 14, 2015, 1:24 AM
Rajeesh MenothPosted Aug 14, 2015, 12:34 AM
anjali khanPosted Aug 14, 2015, 12:22 AM
Sumit JoshiPosted Aug 13, 2015, 7:48 AM
http://csharp.net-informations.com/datagridview/csharp-datagridview-load-excel.htm
Rajeesh MenothPosted Aug 13, 2015, 6:16 AM
C# - The Microsoft Office Access database engine cannot open or write to the file ''. It is already opened exclusively by another user, or you need permission to view and write its data
Mohammed IbrahimPosted Aug 13, 2015, 5:52 AM
anjali khanPosted Aug 13, 2015, 5:06 AM
GridView with Excel File
anjali khanPosted Aug 13, 2015, 5:06 AM
GridView with Excel File
Hemlata KushwahaPosted Aug 13, 2015, 1:32 AM
Hemlata KushwahaPosted Aug 13, 2015, 1:30 AM
Mohammed IbrahimPosted Aug 13, 2015, 12:47 AM
Rajeesh MenothPosted Aug 13, 2015, 12:33 AM
anjali khanPosted Aug 13, 2015, 12:23 AM
Rojalin SahooPosted Aug 12, 2015, 9:12 AM
Rajeesh MenothPosted Aug 12, 2015, 7:34 AM
Upendra Pratap ShahiPosted Aug 12, 2015, 7:12 AM
http://csharp.net-informations.com/datagridview/csharp-datagridview-load-excel.htm