ASP.NET 登录界面
//default.aspx.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Runtime.InteropServices;
using System.Configuration;
using System.Web.UI.WebControls;
using System.Web.Services.Description;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Button4.Attributes.Add("onclick", "window.open('Register.aspx')");//通过button4打开链接
string strConnection = ConfigurationManager.AppSettings["Str.Properties.Settings.masterConnectionString"].ToString();
SqlConnection objConnection = new SqlConnection(strConnection);
objConnection.Open();
SqlCommand cmd = new SqlCommand("select * from judging where name='" + TextBox1.Text.Trim() + "'", objConnection);
string sql = "select * from judging where name='" + TextBox1.Text + "'and password='" + TextBox2.Text + "'";
cmd.CommandText = sql;
/*
***********************************************************************************************
*判断是否有此ID,ExecuteScalar() return the first column of the first row in the result set.
*/
if (cmd.ExecuteScalar() == null)//无此用户
{
Label1.Text = "Sorry, please check your id and psw";
Button3.Visible = false;
}
else
{
Label1.Text ="Welcome to "+TextBox1.Text;
Button3.Visible = true;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Panel1.Visible = false;
Panel2.Visible = true;
}
protected void Button4_Click(object sender, EventArgs e)
{
}
protected void Button3_Click(object sender, EventArgs e)
相关文档:
//压缩
protected void btnY_Click(object sender, EventArgs e)
{
string rar;
RegistryKey reg;
string args;
ProcessStartInfo procStart;
Process process;
try
{
reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRAR.exe\Shell\Open\Command"); ......
1、使用值类型的ToString方法
在连接字符串时,经常使用"+"号直接将数字添加到字符串中。这种方法虽然简单,也可以得到正确结果,但是由于涉及到不同的数据类型,数字需要通过装箱操作转化为引用类型才可以添加到字符串中。但是装箱操作对性能影响较大,因为在进行这类处理时,将在托管堆中分配一个新的对象,原有的值 ......
有很多理由去解释理解ASP.NET页面生命周期是非常重要的,主要是要去理解什么地方放置什么特定的方法,什么时候我们应该设置什么相关的属性。如果去开发自定义的服务器控件,理解生命周期对纠正控件初始化时候的错误,以及使用view-state和后台代码设置属性是非常有用的。(控件事件只与ASP.NET页面相关)
&nb ......
http://www.cnblogs.com/JimmyZhang/archive/2007/11/25/971878.html
引言
Http 请求处理流程 和 Http Handler 介绍 这两篇文章里,我们首先了解了Http请求在服务器端的处理流程,随后我们知道Http请求最终会由实现了IHttpHandler接口的类进行处理(应该记得Page类实现了IHttpHandler)。从 Http 请求处理流程 一文的最后的 ......
<script language="javascript" type="text/javascript">
function doubleSalary()
{
var employee = new Object();
employee.FirstName = "X";
employee.LastName = "PP";
employee.Salary = 1000;
......