?? form4.cs
字號(hào):
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=銀行儲(chǔ)蓄系統(tǒng);Integrated Security=SSPI");
if ((textBox1.Text != "") && (textBox3.Text != "") && (textBox4.Text.Equals(textBox3.Text) ))
{
try
{
connection.Open();
string strSQL = "select * from 帳號(hào)信息 where 用戶帳號(hào)='" + textBox1.Text.ToString() + "'and 密碼='" + textBox2.Text.ToString() + "'";
SqlCommand command = new SqlCommand(strSQL, connection);
SqlDataReader dr = command.ExecuteReader();
if (dr.Read())
{
command.CommandText = "update 帳號(hào)信息 set 密碼 = '" + textBox3.Text.ToString() + "' where 用戶帳號(hào) = '" + textBox1.Text.ToString() + "'";
command.Connection = connection;
command.ExecuteNonQuery();
}
else
{
MessageBox.Show("用戶名或口令有錯(cuò),請(qǐng)重新輸入!");
}
}
catch (SqlException b)
{
Console.WriteLine(b.Message);
}
finally
{
connection.Close();
}
}
else
{
MessageBox.Show("請(qǐng)輸入完整的正確信息!");
}
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -