ASP.NET 连接数据库
这个东西太纠结了~贴出来代码,供大家享用
分三个部分:.config .aspx .aspx.cs
//web.config
<appSettings>
<add key="keystring" value="Data Source=ZRQ-PC;Initial Catalog=OnlineJudge;Integrated Security=True"/>
</appSettings>
//page.aspx
<form id="form2" name="form2" method="post" action="">
<asp:Panel ID="unlogin" runat="server">
<div class="Login" align="center">
<p>Login</p>
用户名<asp:TextBox ID="username" runat="server" Width="106px"></asp:TextBox><br />
密码 <asp:TextBox ID="password" runat="server" Height="22px" Width="106px"></asp:TextBox><br />
<asp:Button ID="submit" runat="server" Text="登录" onclick="submit_Click" />
<asp:Button ID="register" runat="server" Text="注册" />
</div>
</asp:Panel>
<asp:Panel ID="allogin" runat="server" Visible="false">
<div class="Login" align="center">
<asp:Label ID="welcome" runat="server" Text="Label"></asp:Label><br />
<asp:Button ID="alterinfo" runat="server" Text="修改信息" /><br />
<asp:Button ID="logout" runat="server" Text="注销登陆" /><br />
<asp:Button ID="register1" runat="server" Text="注册新用户" /><br />
<asp:Button ID="relogin" runat="server" Text="重新输入密码" />
</div>
</asp:Panel>
</form>
//page.a
相关文档:
在ASP.NET Web窗体应用程序中,推荐的方法是将容器存到由Application字典对象提供的全局状态。当需要的时候你可以访问容器,甚至使用HTTP模块自动完成对页面上控件的注入。
通常情况下,你应该使用Application字典对象来存储容器的单个实例。您可能决定创建主要容器的子容器,并将它们存储到每个用户的Session对象中,甚至 ......
在.Net 4.0之前我们为了做出搜索引擎友好的,对用户也友好的url都是需要自己实现Url重写,现在不需要了,.Net 4.0为我们做这一切。UrlRouting之所以称之为Routing是因为它不但实现了Url重写还可以通过参数得到重写后的Url在页面上使用。
1. Url Routing 的通常用法
UrlRouting在Asp.Net Mvc项目中被广泛使用,在Mvc中很好 ......
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class ......
原帖地址:http://www.cnblogs.com/clingingboy/archive/2006/07/30/463471.html
asp.net本身提供了很多控件,提供给我们这些比较懒惰的人使用,我认为控件的作用就在此,因为我们不想重复工作,所以要创建它,这个本身便是
一个需求的关系,所以学习控件开发很有意思.
wrox网站上有本书 Professional ASP.NET 2.0 Server Cont ......