In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "ASP.NET upload and read Excel file data method tutorial," interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's take you to learn "ASP.NET upload and read Excel file data method tutorial" bar!
In CSDN, people often ask how to open Excel database files. This article through a simple example, realize reading Excel data file.
First, create a Web application project and add a DataGrid control, a file control, and a button control to the Web page.
The copy code is as follows:
First import the OleDb namespace in Code View:
using System.Data.OleDb;
Enter the following code in the button click event:
The copy code is as follows:
string strPath="c://test//" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xls";
File1.PostedFile.SaveAs(strPath);
string mystring="Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = '"+ strPath +"';Extended Properties=Excel 8.0";
OleDbConnection cnnxls = new OleDbConnection (mystring);
OleDbDataAdapter myDa =new OleDbDataAdapter("select * from [Sheet1$]",cnnxls);
DataSet myDs =new DataSet();
myDa.Fill(myDs);
DataGrid1.DataSource=myDs.Tables[0];
DataGrid1.DataBind();
C:/test must have read and write permissions for ASPNET users.
At this point, I believe that everyone on the "ASP.NET upload and read Excel file data method tutorial" has a deeper understanding, may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.