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

推荐订阅源

The Cloudflare Blog
T
Tenable Blog
V
Vulnerabilities – Threatpost
T
Troy Hunt's Blog
SecWiki News
SecWiki News
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Secure Thoughts
Cyberwarzone
Cyberwarzone
A
Arctic Wolf
H
Heimdal Security Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
N
News and Events Feed by Topic
The Hacker News
The Hacker News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cisco Talos Blog
Cisco Talos Blog
Stack Overflow Blog
Stack Overflow Blog
J
Java Code Geeks
Forbes - Security
Forbes - Security
Security Archives - TechRepublic
Security Archives - TechRepublic
Project Zero
Project Zero
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
T
Tor Project blog
WordPress大学
WordPress大学
AWS News Blog
AWS News Blog
Jina AI
Jina AI
阮一峰的网络日志
阮一峰的网络日志
Cloudbric
Cloudbric
O
OpenAI News
U
Unit 42
Google DeepMind News
Google DeepMind News
Simon Willison's Weblog
Simon Willison's Weblog
Recorded Future
Recorded Future
N
News | PayPal Newsroom
S
Schneier on Security
F
Full Disclosure
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The GitHub Blog
The GitHub Blog
Microsoft Security Blog
Microsoft Security Blog
P
Privacy International News Feed
L
LINUX DO - 最新话题
F
Fortinet All Blogs
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CERT Recently Published Vulnerability Notes
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Recent Announcements
Recent Announcements

博客园 - "鸟巢"

SQL2008安装指南 合并两个DataSet Asp.Net学习资源 VS常用快捷键 SQL Server 2005 Full-Text Index 入门 VS2003基础知识一 如何管好下属(转载) VS2003中DataBinder.Eval用法范例 - "鸟巢" - 博客园 数据的增删改 传统行业与网络相结合 CSS中position的理解 Windows Internet服务器安全配置 服务器入侵工具 Ajax 'Sys'未定义错误 转载 .NET工程师求职面试必杀技 分页存储过程 项目管理九大知识体系: 项目负债人手册 中文变问号问题
学习VS2005杂记
"鸟巢" · 2008-02-25 · via 博客园 - "鸟巢"

aspx代码:
  <div>
        <asp:Repeater ID="Repeater1" runat="server">
         <ItemTemplate>
            <div><a href="#"><%# Eval("loginfo")%></a></div><br />            
         </ItemTemplate>
        </asp:Repeater>                   
    </div>
cs代码:
using System.Data.SqlClient;

            SqlConnection conn = new SqlConnection();
            conn.ConnectionString = "Server=(local);DataBase=Codematic;User ID=sa;Password=";
            string strSql = "SELECT * FROM S_LOG";
            SqlCommand cmd = new SqlCommand(strSql);
            cmd.CommandText = strSql;
            SqlDataAdapter da = new SqlDataAdapter();
            DataSet ds = new DataSet();
            cmd.Connection = conn;
            da.SelectCommand = cmd;
            conn.Open();                      
            da.Fill(ds);
            conn.Close();
            this.Repeater1.DataSource = ds.Tables[0].DefaultView;
            this.Repeater1.DataBind();

与2003的不同之处是控件绑定的格式更加简化了:
<%# Eval("loginfo")%>
VS2003的格式:

<asp:TemplateColumn HeaderText="电话">
          <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
          <ItemStyle HorizontalAlign="Center" Width="13%"></ItemStyle>
          <ItemTemplate>
           <%# DataBinder.Eval(Container.DataItem, "TEL") %>
          </ItemTemplate>
         </asp:TemplateColumn>

posted @ 2008-02-25 17:46  "鸟巢"  阅读(166)  评论()    收藏  举报