📄 deleteuser.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 _7计应的班级管理系统
{
public partial class deleteuser : Form
{
public deleteuser()
{
InitializeComponent();
}
private void buttonok_Click(object sender, EventArgs e)
{
string strconn = "user id=sa;data source=localhost;integrated security=false;initial catalog=学生数据库1";
string strsql = "delete from login where 用户名='" + textBoxuid.Text.Trim() + "'";
SqlConnection conn = new SqlConnection(strconn);
try
{
//当没有此用户时...(还没写-_-||)
SqlCommand cmd = new SqlCommand(strsql, conn);
conn.Open();
cmd.ExecuteNonQuery();
MessageBox.Show("删除成功!");
}
catch (SqlException se)
{
MessageBox.Show(se.Message);
}
finally
{
conn.Close();
}
}
private void buttonexit_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -