PersonnelForm.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

//文件名:PersonnelForm.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 MyPersonnel
{
    public partial class PersonnelForm : Form
    {
        public PersonnelForm()
        {
            InitializeComponent();
        }

        private void 基本档案BindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.基本档案BindingSource.EndEdit();
            this.基本档案TableAdapter.Update(this.myPersonnelDataSet.基本档案);

        }

        private void PersonnelForm_Load(object sender, EventArgs e)
        {         
            //获取公司的部门信息            
            String MySQLConnectionString = global::MyPersonnel.Properties.Settings.Default.MyPersonnelConnectionString;
            SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
            MyConnection.Open();
            DataTable MyDepartmentTable = new DataTable();
            string MySQL = "Select * From 公司部门";
            SqlDataAdapter MyAdapter = new SqlDataAdapter(MySQL, MyConnection);
            MyAdapter.Fill(MyDepartmentTable);
            this.部门ComboBox.DataSource = MyDepartmentTable;
            this.部门ComboBox.DisplayMember = "部门名称";
            this.部门ComboBox.ValueMember = "部门名称";
            if (MyConnection.State == ConnectionState.Open)
            {
                MyConnection.Close();
            }
            // TODO: 这行代码将数据加载到表“myPersonnelDataSet.基本档案”中。您可以根据需要移动或移除它。
            this.基本档案TableAdapter.Fill(this.myPersonnelDataSet.基本档案);
            this.myPersonnelDataSet.基本档案.Rows.Clear();
        }

        private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            //自动计算基本档案自编号
            String MySQLConnectionString = global::MyPersonnel.Properties.Settings.Default.MyPersonnelConnectionString;
            SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
            MyConnection.Open();
            SqlCommand MyCommand = MyConnection.CreateCommand();
            MyCommand.CommandText = "Select max(自编号) 最大编号 From 基本档案";
            object MyResult = MyCommand.ExecuteScalar();
            Int64 MyID = 1;
后面还有 53 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。