惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
The Last Watchdog
The Last Watchdog
腾讯CDC
Apple Machine Learning Research
Apple Machine Learning Research
有赞技术团队
有赞技术团队
Last Week in AI
Last Week in AI
量子位
雷峰网
雷峰网
宝玉的分享
宝玉的分享
美团技术团队
阮一峰的网络日志
阮一峰的网络日志
博客园 - 叶小钗
P
Privacy International News Feed
NISL@THU
NISL@THU
V
V2EX
博客园 - 三生石上(FineUI控件)
T
The Exploit Database - CXSecurity.com
T
Threat Research - Cisco Blogs
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
IT之家
IT之家
T
Tor Project blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Threatpost
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
大猫的无限游戏
大猫的无限游戏
V
Vulnerabilities – Threatpost
V
Visual Studio Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
The Hacker News
The Hacker News
Scott Helme
Scott Helme
H
Hacker News: Front Page
罗磊的独立博客
Hacker News - Newest:
Hacker News - Newest: "LLM"
K
Kaspersky official blog
S
Secure Thoughts
www.infosecurity-magazine.com
www.infosecurity-magazine.com
The Cloudflare Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cybersecurity and Infrastructure Security Agency CISA
小众软件
小众软件
月光博客
月光博客
人人都是产品经理
人人都是产品经理
AI
AI
Help Net Security
Help Net Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
酷 壳 – CoolShell
酷 壳 – CoolShell
Webroot Blog
Webroot Blog
博客园 - 【当耐特】
PCI Perspectives
PCI Perspectives
A
Arctic Wolf

博客园 - Leon0812

Export csv Export Excel Jquery pluign development example XML Mail Template Management Resource file management iframe 中显示内嵌页的局部 - Leon0812 - 博客园 easyslider - Leon0812 - 博客园 缩放页面字体 可编辑DIV - Leon0812 - 博客园 vs快捷键大全(转) SQL文件執行 利用IHttpModule、IHttpHandler做授权类 - Leon0812 - 博客园 C#调用非托管的DLL 无缝滚动 - Leon0812 - 博客园 获取-编译-打包 VS作业一条龙批处理 Reporting Service for SQL 2008匿名访问报表方法 獲取控件位置 - Leon0812 - 博客园 Installscript中修改web.config - Leon0812 - 博客园 publish
Excel Reader
Leon0812 · 2011-08-31 · via 博客园 - Leon0812
       string excelFile = Server.MapPath("~/service/data.xlsx");//string strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + excelFile + ";Extended Properties=Excel 8.0;";
string strConn = @"Provider=Microsoft.Ace.OleDb.12.0;Data Source= " + excelFile + ";Extended Properties='Excel 12.0;HDR=No;IMEX=1'";
OleDbDataReader myDataReader
= null;
OleDbConnection myOleDbConnection
= new OleDbConnection(strConn);
OleDbCommand myOleDbCommand
= new OleDbCommand("SELECT * FROM [table1$]", myOleDbConnection);
myOleDbConnection.Open();
myDataReader
= myOleDbCommand.ExecuteReader();
try
{

ModeBiz biz

= new ModeBiz();
Mode model
= new Mode();
string name = string.Empty;
while (myDataReader.Read())
{
model
= new Mode();
name
= myDataReader.GetValue(4).ToString();

biz.Add(model);
}
}

#region Catch
catch (System.Threading.ThreadAbortException ex)
{
ViewBag.ErrMsg
= ex.Message;
}
catch (Exception ex)
{
ViewBag.ErrMsg
= ex.Message;
}
finally
{
myDataReader.Close();
myOleDbConnection.Close();
}
#endregion