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

推荐订阅源

C
Cyber Attacks, Cyber Crime and Cyber Security
The Last Watchdog
The Last Watchdog
Forbes - Security
Forbes - Security
S
Security @ Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
T
Troy Hunt's Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
W
WeLiveSecurity
WordPress大学
WordPress大学
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
News | PayPal Newsroom
D
DataBreaches.Net
博客园_首页
Y
Y Combinator Blog
F
Fortinet All Blogs
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
T
Tailwind CSS Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Hugging Face - Blog
Hugging Face - Blog
The GitHub Blog
The GitHub Blog
B
Blog RSS Feed
C
CERT Recently Published Vulnerability Notes
P
Privacy & Cybersecurity Law Blog
Help Net Security
Help Net Security
S
SegmentFault 最新的问题
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
N
News and Events Feed by Topic
Schneier on Security
Schneier on Security
V
Vulnerabilities – Threatpost
A
About on SuperTechFans
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
L
LangChain Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
GbyAI
GbyAI
L
LINUX DO - 热门话题
Simon Willison's Weblog
Simon Willison's Weblog
雷峰网
雷峰网
G
Google Developers Blog
Cyberwarzone
Cyberwarzone
I
Intezer
Google DeepMind News
Google DeepMind News
AWS News Blog
AWS News Blog
C
Check Point Blog
AI
AI
博客园 - 【当耐特】
有赞技术团队
有赞技术团队
博客园 - 司徒正美

博客园 - Daniel Pang

pcanywhere失去连接的一个解决方法 JS格式化日期字符串 - Daniel Pang - 博客园 [软件共享]将数据库中的数据导出为SQL脚本 对文件下载的补充 - Daniel Pang - 博客园 复制DataTable的一种方法 IBatisNet + Castle 开发相关文章 [IBatisNet]关于返回DataTable的一点问题 深圳电话订票基本步骤及所有的取票点地址电话 Automatic Transaction Management Facility 使用 - Daniel Pang IBatisnet Facility 的几种配置 - Daniel Pang IBatisNet -- 保护你的配置文件及映射文件信息 Rational Rose 加载出错的问题 修改Sql server中列的属性脚本 字符串加密方法 ERP术语 英文对照(部分)(参考) 一个关于SQL2005的问题 动态加载TreeNode -- ComponentArt TreeView - Daniel Pang 使用IBatisNet + Castle 开发DotNet软件 JS--屏蔽浏览器右键菜单
Excel的导出操作 - Daniel Pang - 博客园
Daniel Pang · 2006-12-06 · via 博客园 - Daniel Pang

下面的代码展示了如何将Excel内容显示到GridView中:
aspx代码:

.aspx

.cs代码:

protected void btnImport_Click(object sender, EventArgs e)
        
{
            
string Path = f_path.Value;
            
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Path + ";" + "Extended Properties=Excel 8.0;";
            OleDbConnection conn 
= new OleDbConnection(strConn);
            conn.Open();
            
string strExcel = "";
            OleDbDataAdapter myCommand 
= null;
            DataSet ds 
= null;
            strExcel 
= "select * from [sheet1$]";
            myCommand 
= new OleDbDataAdapter(strExcel, strConn);
            ds 
= new DataSet();
            myCommand.Fill(ds, 
"table1");

            gv_list.DataSource 
= ds;
            gv_list.DataBind();

        }