default1.aspx.cs
来自「实现货物运输的查询:入库管理、库存管理、出库管理、员工基本信息管理等。」· CS 代码 · 共 55 行
CS
55 行
using System;
using System.Data;
using System.Configuration;
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)
{
if (!Page.IsPostBack)
{
this.Label2.Text = "";
}
}
protected void Button3_Click(object sender, EventArgs e)
{
this.TextBox1.Text = "";
this.TextBox2.Text = "";
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Server=.;Database=物流公司货运管理;uid=sa;pwd=;");
con.Open();
SqlCommand cmd = new SqlCommand("select count(*) from 用户表 where 用户编号 ='" +TextBox1.Text + "' and 密码='" + TextBox2.Text + "'", con);
int count = Convert.ToInt32(cmd.ExecuteScalar());
if (count > 0)
{
Response.Redirect("main.aspx");
}
else
{
this.Label2.Text = "用户名或密码不正确,登录失败!!!";
}
}
protected void TextBox2_TextChanged(object sender, EventArgs e)
{
int len = ((TextBox)sender).Text.Length;
if (len < 6 || len > 20)
this.Label2.Text = "密码必须在6位数字和20位数字之间!";
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("wangjimima.aspx");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?