private DataSet InExecl()
{
//string filename = get.filenames;
//string filename =get.filenames ;
string filename = Label23.Text;
DataSet ds = new DataSet();
string connStr = "Provider=Microsoft.Ace.OleDb.12.0;Data Source=" + Server.MapPath("up_product_store" + "\\" + filename) + "; Extended Properties=Excel 8.0;";
OleDbConnection myConn = new OleDbConnection(connStr);
myConn.Open();
DataTable dt = myConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
string tableNamess = dt.Rows[0][2].ToString().Trim();
string strSQL = " SELECT * from [" + tableNamess + "] ";
OleDbDataAdapter myCommand = new OleDbDataAdapter(strSQL, myConn);
DataSet myDataSet = new DataSet();
myCommand.Fill(myDataSet, tableNamess);
myConn.Close();
//myConn.Dispose();
myConn.Dispose();
myCommand.Dispose();
return myDataSet;
}
读取EXECL文件内容,可以支持分布
最新推荐文章于 2025-05-14 20:58:39 发布
