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

推荐订阅源

CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Security Latest
Security Latest
C
CXSECURITY Database RSS Feed - CXSecurity.com
AI
AI
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
P
Palo Alto Networks Blog
Spread Privacy
Spread Privacy
Project Zero
Project Zero
Google Online Security Blog
Google Online Security Blog
The Cloudflare Blog
L
LangChain Blog
T
Tenable Blog
GbyAI
GbyAI
C
Cybersecurity and Infrastructure Security Agency CISA
大猫的无限游戏
大猫的无限游戏
Last Week in AI
Last Week in AI
量子位
Cloudbric
Cloudbric
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
美团技术团队
S
Secure Thoughts
P
Privacy & Cybersecurity Law Blog
S
Securelist
S
Schneier on Security
F
Full Disclosure
Engineering at Meta
Engineering at Meta
A
Arctic Wolf
Microsoft Security Blog
Microsoft Security Blog
Apple Machine Learning Research
Apple Machine Learning Research
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
爱范儿
爱范儿
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
P
Privacy International News Feed
宝玉的分享
宝玉的分享
A
About on SuperTechFans
博客园 - 【当耐特】
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hugging Face - Blog
Hugging Face - Blog
Webroot Blog
Webroot Blog
Google DeepMind News
Google DeepMind News
H
Heimdal Security Blog
Y
Y Combinator Blog
月光博客
月光博客
H
Hacker News: Front Page
MongoDB | Blog
MongoDB | Blog
C
Check Point Blog
TaoSecurity Blog
TaoSecurity Blog
腾讯CDC
N
Netflix TechBlog - Medium

博客园 - "鸟巢"

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)  评论()    收藏  举报