From 2fa366126db1b561bf6637eb7efbd7a4469ad682 Mon Sep 17 00:00:00 2001 From: aufe20200933 Date: Wed, 30 Nov 2022 16:40:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E6=B7=BB=E5=8A=A0=E5=9B=BE?= =?UTF-8?q?=E4=B9=A6=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tianjiatushu.cs | 95 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 tianjiatushu.cs diff --git a/tianjiatushu.cs b/tianjiatushu.cs new file mode 100644 index 0000000..a87c9db --- /dev/null +++ b/tianjiatushu.cs @@ -0,0 +1,95 @@ +//熊宇杰 20200933 +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Data.SqlClient; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace tushuguanli +{ + public partial class tianjiatushu : Form + { + public tianjiatushu() + { + InitializeComponent(); + } + private void Form1_Load(object sender, EventArgs e) + { + + } + //创建数据库连接 + + private void button1_Click(object sender, EventArgs e) + { //连接数据库 + string str = @"Data Source=LAPTOP-HKE14BIG;Initial catalog=BookDB;integrated Security=True"; + SqlConnection conn = new SqlConnection(str); + conn.Open(); + //分别插入书号、书名、书作者、出版社、数量 + string selectsql = "insert into t_book values('" + textBox_Bid.Text + "','" + textBox_Bname.Text + "','" + textBox_Bauthor.Text + "','" + textBox_Bpress.Text +"','" + textBox_Bnu.Text + "')"; + SqlCommand cmd = new SqlCommand(selectsql, conn); + cmd.CommandType = CommandType.Text; + SqlDataReader sdr; + sdr = cmd.ExecuteReader(); + conn.Close(); + + + MessageBox.Show("添加成功!", "添加图书", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + + + } + ////////////////////////////////// + /// + + //添加书号 + private void label_Bid_Click(object sender, EventArgs e) + { + //书号标签:label_Bid + } + private void textBox_Bid_TextChanged(object sender, EventArgs e) + { + //文本按钮命名:textBox_Bid + } + //添加书名 + private void label_Bname_Click(object sender, EventArgs e) + { + //书名标签:label_Bname + } + private void textBox_Bname_TextChanged(object sender, EventArgs e) + { + //文本按钮命名:textBox_Bname + } + //添加作者 + private void label_Bauthor_Click(object sender, EventArgs e) + { + //书号标签:label_Bauthor + } + private void textBox_Bauthor_TextChanged(object sender, EventArgs e) + { + //文本按钮命名:textBox_Bautho + } + //添加出版社 + private void label_Bpress_Click(object sender, EventArgs e) + { + //书号标签:label_Bpress + } + private void textBox_Bpress_TextChanged(object sender, EventArgs e) + { + //文本按钮命名:textBox_Bpress + } + //添加数量 + private void label_Bnu_Click(object sender, EventArgs e) + { + //数量标签:label_Bnu + } + private void textBox_Bnu_TextChanged(object sender, EventArgs e) + { + //文本按钮命名:textBox_Bnu + } + + } +} \ No newline at end of file