?? 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 login : System.Web.UI.Page
{
SqlConnection sqlcon = new SqlConnection();
SqlCommand sqlcmd = new SqlCommand();
String connectionString = "Data Source=jpsoft02\new;Initial Catalog=starsparkz;Integrated Security=True";
Int32 uid = 0;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection sqlcon = new SqlConnection(connectionString);
sqlcon.Open();
SqlCommand sqlcmd = new SqlCommand("SELECT userid FROM mylogintable where username='" + txtusname.Text + "' and userpass='" + txtpassword.Text + "'", sqlcon);
SqlDataReader sqldr = sqlcmd.ExecuteReader();
while (sqldr.Read())
{
uid =Convert.ToInt32(sqldr["userid"]);
if (uid > 0)
{
Response.Redirect("myaccount.aspx?id=" + sqldr["userid"]);
}
else
{
Response.Redirect("Invalidlogin.aspx");
}
}
sqlcon.Close();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -