⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 updatebooks.cs

📁 这是个C#做成的图书管理系统,请大家参考,多提建议
💻 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.IO;

namespace BookMS
{
    public partial class UpdateBooks : Form
    {
        public UpdateBooks()
        {
            InitializeComponent();
        }

        private void Revisedbutton_Click(object sender, EventArgs e)
        {
            DataSet ds = new DataSet("BookDs");

            if (File.Exists("..\\..\\BookDs.ds"))
            {
                ds.ReadXml("..\\..\\BookDs.ds");

                ds.Tables["BookTab"].PrimaryKey = new DataColumn[] { ds.Tables["BookTab"].Columns["BookID"] };
                
                if (BookIDBox.Text != "" && BookNameBox.Text != "" && BookNumBox.Text != "")
                {
                    DataRow dr = ds.Tables["BookTab"].Rows.Find(BookIDBox.Text.Trim());
                    dr["BookName"] = BookNameBox.Text.ToString();
                    dr["Publishing"] = PublishBox.Text.ToString();
                    dr["BookNum"] = Convert.ToInt32(BookNumBox.Text.Trim());
                    dr["Author"] = AuthorBox.Text.ToString();
                    dr["Publishingtime"] = Convert.ToDateTime(PubtimePicker.Text).ToLongDateString();


                    ds.Tables["BookTab"].WriteXml("..\\..\\BookDs.ds");

                    MessageBox.Show("修改成功!");
                }
                else
                {
                    MessageBox.Show("字体加重的项目必须填写完整!", "提示");
                }
            }
            else
            {
                MessageBox.Show("请与管理员确认服务是否启动", "提示", MessageBoxButtons.RetryCancel);
            }
        }

        private void Cancelbutton_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -