12
返回列表 发新帖
楼主: submarine

这里人气不旺呀,是不是这里做.Net的人少呀?

[复制链接]
论坛徽章:
20
2008新春纪念徽章
日期:2008-02-13 12:43:03ITPUB十周年纪念徽章
日期:2011-11-01 16:21:15鲜花蛋
日期:2011-07-07 15:01:11ITPUB9周年纪念徽章
日期:2010-10-08 09:34:032010新春纪念徽章
日期:2010-03-01 11:08:31ITPUB元老
日期:2009-10-19 22:38:19祖国60周年纪念徽章
日期:2009-10-09 08:28:00ITPUB8周年纪念徽章
日期:2009-09-27 10:21:21生肖徽章2007版:猪
日期:2008-10-19 14:40:082012新春纪念徽章
日期:2012-01-04 11:51:22
11#
发表于 2006-7-7 17:17 | 只看该作者
会好的

使用道具 举报

回复
论坛徽章:
38
2013年新春福章
日期:2013-12-19 20:30:122013年新春福章
日期:2013-12-19 20:30:122013年新春福章
日期:2013-12-19 20:30:122013年新春福章
日期:2013-12-19 20:30:122013年新春福章
日期:2013-12-19 20:30:122013年新春福章
日期:2013-12-19 20:30:122013年新春福章
日期:2013-12-19 20:30:122013年新春福章
日期:2013-12-19 20:30:122013年新春福章
日期:2013-12-19 20:30:122013年新春福章
日期:2013-12-19 20:30:12
12#
发表于 2006-7-19 11:01 | 只看该作者
是啊, 会好的, 一定支持

使用道具 举报

回复
论坛徽章:
0
13#
发表于 2006-7-25 18:46 | 只看该作者

问个问题?!

1.aspx和2.aspx有何不同?
1.aspx:
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Page Language="C#" Debug="true" %>

<html>
<script language="C#" runat="server">
   void Page_Load(Object sender, EventArgs e)
   {
      
      SqlConnection myConnection = new SqlConnection("server=WEIPENG;database=pubs;uid =sa;pwd=123;";
      
      SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM" +
         " Titles", myConnection);
      
      DataSet ds = new DataSet();
      sda.Fill(ds);
      
      MyRepeater.DataSource = ds;
      MyRepeater.DataBind();
   }
</script>


<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
   <ASP:Repeater id="MyRepeater" runat="server">
      <HeaderTemplate>
         <Table width="100%" style="font: 8pt verdana">
            <tr style="background-color : DFA894">
               <th>
                  Title
               </th>
               <th>
                  Title ID
               </th>
               <th>
                  Type
               </th>
               <th>
                  Publisher ID
               </th>
               <th>
                  Price
               </th>
            </tr>
      </HeaderTemplate>

      <ItemTemplate>
            <tr style="background-color:FFECD8">
               <td>
                  <%# DataBinder.Eval(Container.DataItem, "title" %>
               </td>
               <td>
                  <%# DataBinder.Eval(Container.DataItem,"title_id" %>
               </td>
               <td>
                  <%# DataBinder.Eval(Container.DataItem, "type" %>
               </td>
               <td>
                  <%# DataBinder.Eval(Container.DataItem, "pub_id" %>
               </td>
               <td>
                  <%# DataBinder.Eval(Container.DataItem,
                     "price", "{0:c}" %>
               </td>
            </tr>
      </ItemTemplate>

      <FooterTemplate>
         </Table>
      </FooterTemplate>
   </ASP:Repeater>
</body>
</html>
2.aspx
<% Import Namespace="System.Data" %>
<% Import Namespace="System.Data.SqlClient" %>
<% Page Language = "C#" Debug = "true" %>
<html>
<script language = "C#" runat = "server">
void Page_Load (Object sender, EventArgs e)
{
SqlConnection myConnection = new SqlConnection ("server=WEIPENG;database=pubs;uid=sa;pwd=123;";
SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM " + "Titles", myConnection);
DataSet ds = new DataSet();
sda.Fill(ds);
MyRepeater.DataSource = ds;
MyRepeater.DataBind();
}
</script>

<body topmargin = "0" leftmargin = "0" marginwidth="0" marginheight="0">
<ASP:Repeater id ="MyRepeater" runat ="server">
<HeaderTemplate>
<Table width ="100%" style ="font:8pt verdana">
<tr style = "background-color : DFA894">
<th>Title</th>
<th>Title ID </th>
<th>Type</th>
<th>Publisher ID </th>
<th>Price </th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style ="background-color:FFECD8">
<td><%# DataBinder.Eval(Container.DataItem, "title" %>
</td>
<td><%# DataBinder.Eval(Container.DataItem, "title_id" %>
</td>
<td><%# DataBinder.Eval(Container.DataItem, "type" %>
</td>
<td><%# DataBinder.Eval(Container.DataItem, "pub_id") %>
</td>
<td><%# DataBinder.Eval(Container.DataItem, "price", "{0:c}") %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</Table>
</FooterTemplate>
</ASP:Repeater>
</body>
</html>
1.aspx能正常运行读到数据 2.aspx报错:编译器错误信息: CS0246: 找不到类型或命名空间名称“SqlConnection”(是否缺少 using 指令或程序集引用?)

行 8:  SqlConnection myConnection = new SqlConnection ("server=WEIPENG;database=pubs;uid=sa;pwd=123;");

使用道具 举报

回复
论坛徽章:
0
14#
发表于 2006-7-25 18:51 | 只看该作者

切图

1.aspx

切图传不上来,或者我不会传!

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表