📄 shanchuduzhexinxi.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 tsh
{
public partial class shanchuduzhexinxi : Form
{
public shanchuduzhexinxi()
{
InitializeComponent();
}
DB.ClsSQL sql = new DB.ClsSQL(".", "mylw", "sa", "", 3);
DataSet ds, ds1;
private void butttch_Click(object sender, EventArgs e)
{
this.Close();
}
private void buttqx_Click(object sender, EventArgs e)
{
textBbianhao.Text = "";
textBbianhao.Focus();
textBdh.Text = "";
textBE.Text="";
textBleibie.Text="";
textBdw.Text="";
textBxingbie.Text="";
textBxingming.Text="";
textBzhuangtai.Text="";
buttshch.Enabled = false;
buttqx.Enabled = false;
}
private void textBbianhao_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 13)
{
string s = "select * from reader where duzhebianhao='" + textBbianhao.Text + "'";
ds = sql.DBToDS(s, "reader");
int n = ds.Tables["reader"].Rows.Count;
if (n == 0)
{
buttqx_Click(null, null);
MessageBox.Show("无此读者编号!!", "信息提示");
}
else
{
string s1 = "select * from borrow where duzhebianhao='" + textBbianhao.Text + "'";
ds1 = sql.DBToDS(s1, "borrow");
int i = ds1.Tables["borrow"].Rows.Count;
if (i != 0)
{
MessageBox.Show("该读者已在本馆借书,不允许删除该读者记录!!", "提示");
textBbianhao.Text = "";
textBbianhao.Focus();
buttshch.Enabled = false;
buttqx.Enabled = false;
}
else
{
textBdh.Text =ds.Tables["reader"].Rows[0]["dianhua"].ToString();
textBE.Text = ds.Tables["reader"].Rows[0]["Email"].ToString();
textBleibie.Text = ds.Tables["reader"].Rows[0]["duzheleibie"].ToString();
textBdw.Text = ds.Tables["reader"].Rows[0]["danwei"].ToString();
textBxingbie.Text = ds.Tables["reader"].Rows[0]["xingbie"].ToString();
textBxingming.Text = ds.Tables["reader"].Rows[0]["duzhexingming"].ToString();
textBzhuangtai.Text = ds.Tables["reader"].Rows[0]["shuzhengzhuangtai"].ToString();
buttshch.Enabled = true;
buttqx.Enabled = true;
buttshch.Focus();
}
}
}
}
private void buttshch_Click(object sender, EventArgs e)
{
string dzhm = ds.Tables["reader"].Rows[0]["duzhexingming"].ToString();
DialogResult result = MessageBox.Show("真的要删除“" + dzhm + "”这个读者的信息吗??", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
string bh = ds.Tables["reader"].Rows[0]["duzhebianhao"].ToString();
string s2 = "delete from reader where duzhebianhao='" + bh + "'";
sql.SQLCommand(s2);
MessageBox.Show("已成功删除一条读者信息!!!", "提示");
buttqx_Click(null, null);
}
else
{
buttqx_Click(null, null);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -