Reading Excel

xiaoxiao2021-03-06  62

Namespace Using System.Data.OLDB; Private Void Excelread () {string patHexcel = "Haha.xls"; // Excel path

// read Excel pathExcel = Server.MapPath (pathExcel); string myString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = '" pathExcel "'; Extended Properties = Excel 8.0"; OleDbConnection cnnXls = new OleDbConnection mYString;

String SQLINBOX = "Select * from [Sheet1 $]"; OLEDBDataAdapter DRINBOX = New OLEDBDataAdapter (SQLINBOX, CNNXLS);

DataSet DSINBOX = New Dataset (); DrinBox.Fill (DSINBOX); if (DSINBOX.TABLES [0] .rows.count> 0) {for (int i = 0; i

转载请注明原文地址:https://www.9cbs.com/read-112326.html

New Post(0)