In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces the "problems that ASP.NET needs to pay attention to when operating Excel tables". In daily operation, I believe that many people have doubts about the problems that many people need to pay attention to when operating Excel tables in ASP.NET. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the questions that you need to pay attention to when operating Excel tables in ASP.NET. Next, please follow the editor to study!
When ASP.NET manipulates EXCEL tables, you need to pay attention to the following:
ASP.NET operates EXCEL1 and adds references to oledb
Using System.Data.OleDb
ASP.NET manipulates EXCEL2 and gets the path of excel, which varies depending on the control used. In asp.net2003, you can only use the HTML control File Field. The acquired path excel_route=this.File1.PostedFile.FileName.ToString ()
In asp.net2005, because of the web control FileUpload, the path obtained
String excel_route = this.FileUpload1.PostedFile.FileName.ToString ()
Although all are the same, 05 is still easier to use than 03.
ASP.NET operates EXCEL3, depending on whether you use the Excel version, you need to use different drives to establish a link with excel. At present, office2003 is the most commonly used office, and the drive type is
String connStr = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source ='" + excel_route + "'; Extended Properties=Excel 8.0;"
ASP.NET operates on EXCEL4 and Excel, just like reading database tables correctly, except that the table name of the excel database is the name of the workbook, that is, the sheet name.
String load_excel = "SELECT * FROM [" + sheet_name + "$]"
By default, the workbook name is sheet1, but sometimes users will change their names privately, so * allows users to enter their own sheet name.
When ASP.NET manipulates EXCEL5 and reads excel tables, it should be noted that some excel are exported from the program and output html code directly to Excel using Response. This excel table will prompt when reading.
"external table is not in the expected format" error, you need to manually open the excel table and then save it again.
ASP.NET manipulates EXCEL6 and read excel data, just like a normal database
DataSet ds = new DataSet (); ds.Dispose (); OleDbDataAdapter da = new OleDbDataAdapter (load_excel, connStr); da.Fill (ds)
In this way, the Excel data is read into ds, and the rest can be manipulated at will.
At this point, the study on "problems that ASP.NET needs to pay attention to when operating Excel tables" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.