最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp.net 获取excel工作溥数据与连接方法(vb.net,c#)
时间:2022-06-25 06:04:47 编辑:袖梨 来源:一聚教程网
asp教程.net 获取excel工作溥数据与连接方法
c#读取excel数据表方法
<%@ Page Language="C#" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
void Page_Load(object sender, EventArgs e) {
string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:Yourspreadsheet.xls; Extended Properties=""Excel 8.0;HDR=Yes"";";
string CommandText = "select * from [Book$]";
OleDbConnection myConnection = new OleDbConnection(ConnectionString);
OleDbCommand myCommand = new OleDbCommand(CommandText, myConnection);
myConnection.Open();
DataGrid1.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
DataGrid1.DataBind();
myConnection.Close();
}
Simple Data Report
vb.net读取excel数据方法
<%@ Import namespace="System.Data" %>
<%@ Import namespace="System.Data.OleDb" %>
Reading from an Excel Workbook
Reading from an Excel Workbook
相关文章
- 火影忍者怎么获得大招 05-03
- 星际战甲新手什么刀好 05-03
- 文明6秦始皇金字塔怎么加速 05-03
- 全民奇迹2龙骸巨剑怎么获得 05-03
- 星露谷物语鲟鱼怎么获得 05-03
- 长安幻想怎么转职 05-03