📄 form4.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace Store
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
this.Focus();
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
SqlConnection connection = new SqlConnection("Data Source=localhost;Initial Catalog=银行储蓄系统;Integrated Security=SSPI");
if ((textBox1.Text != "") && (textBox3.Text != "") && (textBox4.Text.Equals(textBox3.Text) ))
{
try
{
connection.Open();
string strSQL = "select * from 帐号信息 where 用户帐号='" + textBox1.Text.ToString() + "'and 密码='" + textBox2.Text.ToString() + "'";
SqlCommand command = new SqlCommand(strSQL, connection);
SqlDataReader dr = command.ExecuteReader();
if (dr.Read())
{
command.CommandText = "update 帐号信息 set 密码 = '" + textBox3.Text.ToString() + "' where 用户帐号 = '" + textBox1.Text.ToString() + "'";
command.Connection = connection;
command.ExecuteNonQuery();
}
else
{
MessageBox.Show("用户名或口令有错,请重新输入!");
}
}
catch (SqlException b)
{
Console.WriteLine(b.Message);
}
finally
{
connection.Close();
}
}
else
{
MessageBox.Show("请输入完整的正确信息!");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -