最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp.net C# 读取Excel数据代码
时间:2022-06-25 05:06:33 编辑:袖梨 来源:一聚教程网
asp教程.net c# 读取excel数据代码
public dataset exceltods(string path)
{
string con = "provider=microsoft.jet.oledb.4.0;data source="+"e:collegemisupexcel" + fileupload1.filename+";extended properties='excel 8.0;imex=1'";
oledbconnection olecon = new oledbconnection(con);
oledbdataadapter oleda = new oledbdataadapter("select * from [sheet1$]", con);//sheet1是sheet的名字
string strexcel = "";
oledbdataadapter mycommand = null;
dataset ds = null;
//从excel的一个工作表中导入数据到数据库教程中
strexcel = "select 门牌号,用户名,用户人口数目,用户住房面积,用户取暖面积,用户电话,用户工作单位,用户数据类型 from [sheet1$]";
try
{
mycommand = new oledbdataadapter(strexcel, strconn);
ds = new dataset();
mycommand.fill(ds, "table1");
}
catch(exception e)
{
conn.close();
mycommand.dispose();
}
return ds;
}
//sheet1是sheet的名字
相关文章
- 抖音官方充值入口-抖音充值活动任务奖励领取入口 12-18
- 哔哩哔哩在线免费畅看-2025哔哩哔哩b站网页版最新入口速览 12-18
- 一人之下漫画免费在线观看入口 | 实时缓存无延迟,网页直读免下载 12-18
- 免费PPT成品网站直播推荐-超全免费PPT模板网站盘点 12-18
- 学信网查学历-官方学历查询入口(一键验证学历信息) 12-18
- 虫虫漫画-免费漫画观看入口_海量正版漫画在线畅读平台 12-18