📄 form1.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace 团委组织部信息系统
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
Form7 f7 = new Form7();
f7.Show();
this.Hide();
}
private void button1_Click_1(object sender, EventArgs e)
{
if (textuserID.Text == "" | textpassword.Text == "")
{
MessageBox.Show("请输入用户名,密码!");
this.textuserID.Clear();
this.textpassword.Clear();
//this.textUserID.();
return;
}
SqlConnection conn = new SqlConnection("Data Source=localhost;Initial Catalog=tuanweizuzhibu_inf;Integrated Security=SSPI;");
string sqlText = "exec login_proc @UserName,@Password";
SqlCommand sqlcmd = new SqlCommand(sqlText, conn);
sqlcmd.Parameters.AddWithValue("@UserName", this.textuserID.Text);
sqlcmd.Parameters.AddWithValue("@Password", this.textpassword.Text);
conn.Open();
SqlDataReader sqldr = sqlcmd.ExecuteReader();
if (sqldr.Read())
{
MessageBox.Show("Welcome to our world!");
Form2 fm = new Form2();
this.Hide();
fm.Show();
}
else
{
MessageBox.Show("登录失败!");
}
}
private void button2_Click(object sender, EventArgs e)
{
}
private void button4_Click(object sender, EventArgs e)
{
textuserID.Text = "";
textpassword.Text = "";
}
private void button2_Click_1(object sender, EventArgs e)
{
this.Hide();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -