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 MenothRank #118 · 18.4K reputationPosted Aug 16, 2015, 9:09 PM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Aug 12, 2015, 3:12 AM EDT
http://csharp.net-informations.com/datagridview/csharp-datagridview-load-excel.htm
Rajeesh MenothRank #118 · 18.4K reputationPosted Aug 12, 2015, 3:34 AM EDT
Rojalin SahooRank #2,919 · 493 reputationPosted Aug 12, 2015, 5:12 AM EDT
anjali khanRank #4,788 · 325 reputationPosted Aug 12, 2015, 8:23 PM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Aug 12, 2015, 8:33 PM EDT
Mohammed IbrahimRank #685 · 3.5K reputationPosted Aug 12, 2015, 8:47 PM EDT
Hemlata KushwahaRank #6,963 · 252 reputationPosted Aug 12, 2015, 9:30 PM EDT
Hemlata KushwahaRank #6,963 · 252 reputationPosted Aug 12, 2015, 9:32 PM EDT
anjali khanRank #4,788 · 325 reputationPosted Aug 13, 2015, 1:06 AM EDT
GridView with Excel File
anjali khanRank #4,788 · 325 reputationPosted Aug 13, 2015, 1:06 AM EDT
GridView with Excel File
Mohammed IbrahimRank #685 · 3.5K reputationPosted Aug 13, 2015, 1:52 AM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Aug 13, 2015, 2:16 AM EDT
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
Sumit JoshiRank #1,252 · 1.4K reputationPosted Aug 13, 2015, 3:48 AM EDT
http://csharp.net-informations.com/datagridview/csharp-datagridview-load-excel.htm
anjali khanRank #4,788 · 325 reputationPosted Aug 13, 2015, 8:22 PM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Aug 13, 2015, 8:34 PM EDT
Hemlata KushwahaRank #6,963 · 252 reputationPosted Aug 13, 2015, 9:24 PM EDT
anjali khanRank #4,788 · 325 reputationPosted Aug 16, 2015, 9:06 PM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Aug 16, 2015, 9:39 PM EDT
Satinder Singh189 reputationPosted Aug 19, 2015, 11:43 PM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts