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

推荐订阅源

宝玉的分享
宝玉的分享
AWS News Blog
AWS News Blog
Y
Y Combinator Blog
云风的 BLOG
云风的 BLOG
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
F
Full Disclosure
H
Help Net Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
A
About on SuperTechFans
J
Java Code Geeks
Jina AI
Jina AI
GbyAI
GbyAI
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
美团技术团队
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Latest news
Latest news
Vercel News
Vercel News
博客园 - 【当耐特】
P
Privacy & Cybersecurity Law Blog
P
Proofpoint News Feed
阮一峰的网络日志
阮一峰的网络日志
V
Vulnerabilities – Threatpost
Stack Overflow Blog
Stack Overflow Blog
Hugging Face - Blog
Hugging Face - Blog
D
Docker
Microsoft Security Blog
Microsoft Security Blog
博客园_首页
S
Securelist
WordPress大学
WordPress大学
S
Secure Thoughts
博客园 - 聂微东
Cloudbric
Cloudbric
Help Net Security
Help Net Security
腾讯CDC
T
Threat Research - Cisco Blogs
T
Tor Project blog
L
LINUX DO - 热门话题
Project Zero
Project Zero
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - Franky
N
Netflix TechBlog - Medium
小众软件
小众软件
Cyberwarzone
Cyberwarzone
量子位
MyScale Blog
MyScale Blog
W
WeLiveSecurity
MongoDB | Blog
MongoDB | Blog
I
InfoQ
M
MIT News - Artificial intelligence

博客园 - eFeng.Leung

枚举Exchange Server、SotreGroups和MailStore Single Sign-On for everyone 关于AD编程的一些资料 zz 不同的asp.net web应用程序间共享Session/Application - eFeng.Leung - 博客园 Code Project中几篇关于DNN的文章 Authenticate a user against the Active Directory using the user ID and password User Object User Interface Mapping Lists all entries in the Active Directory Using Active Directory Active Directory and .NET LDAP, IIS and WinNT Directory Services 无法破解的软件注册码算法 SQL2K集群 绑定在 TCP 端口 1433 上失败 使用HTTP访问2003表单登录页 (转) FYI: Getting Started with WebDAV 遭遇 对路径“C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\aa\……”的访问被拒绝 - eFeng.Leung 网络负载平衡部署 Group Panel 鼠标移动,改变datagrid里行的色
在DataGrid里显示Excel文件数据
eFeng.Leung · 2006-01-26 · via 博客园 - eFeng.Leung

    using System.Data.OleDb;

private void Page_Load(object sender, System.EventArgs e)
        
{
            
// 在此处放置用户代码以初始化页面
            if(!IsPostBack) 
            
{
                SetBind() ;
            }

        }

        
protected void SetBind() 
        
{
            
try
            
{
                
string strConn; 
                strConn 
= "Provider=Microsoft.Jet.OLEDB.4.0;" 
                    
+"Data Source=c:\\abc.xls;" 
                    
+"Extended Properties=Excel 8.0;"
                
OleDbDataAdapter myCommand   = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn); 
                DataSet myDataSet 
= new DataSet(); 
                myCommand.Fill( myDataSet, 
"mobile"); 
                DataGrid1.DataSource 
= myDataSet.Tables["mobile"].DefaultView; 
                DataGrid1.DataBind();
            }

            
catch (Exception ex)
            
{
                Label1.Text 
= ex.ToString();
            }

        }


        
private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
        
{
            
this.DataGrid1.CurrentPageIndex =   e.NewPageIndex;
            SetBind() ;
        }


        
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
        
{
            
if(e.Item.ItemType == ListItemType.Item | e.Item.ItemType == ListItemType.AlternatingItem )
            
{
               

                e.Item.Attributes.Add("onmouseover","this.style.backgroundColor='Silver' ");
                e.Item.Attributes.Add(
"onmouseout","this.style.backgroundColor='white' ");
                        }
            }