?? admin_login.aspx.cs
字號:
?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;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btdl_Click(object sender, EventArgs e)
{
string id = this.tbuserName.Text.Trim();
string pwd = this.tbPwd.Text.Trim();
SqlConnection con = new SqlConnection("Data Source=localhost;Initial Catalog=Bus;Integrated Security=True");
SqlCommand cmd = new SqlCommand("select count(*) from admin where UserName='" + id + "' and Pwd='"+pwd +"'", con);
con.Open ();
int count=Convert .ToInt32 (cmd .ExecuteScalar() );
con.Close();
if (count > 0)
{
Response.Redirect("admin_admin.aspx");
}
else
{
Response .Write ("<script language=javascript> alert('用戶名或密碼錯誤!'); </script>");
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -