frmunits.cs

来自「资产评估管理系统 实例文件夹:EquipmentMS 数据库:采用SQL 」· CS 代码 · 共 52 行

CS
52
字号
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace EquipmentMS.SystemSet
{
    public partial class frmUnits : Form
    {
        EquipmentMS.BaseClass.Operation oper = new EquipmentMS.BaseClass.Operation();
        public frmUnits()
        {
            InitializeComponent();
        }

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

        private void frmUnits_Load(object sender, EventArgs e)
        {
            DataSet ds = oper.GetDataSetUnits();
            if (ds.Tables[0].Rows.Count > 0)
            {
                txtUnits.Text = ds.Tables[0].Rows[0]["units"].ToString();
                txtUnitsAddress.Text = ds.Tables[0].Rows[0]["address"].ToString();
                txtTel.Text = ds.Tables[0].Rows[0]["tel"].ToString();
                txtLinkman.Text = ds.Tables[0].Rows[0]["linkman"].ToString();
                txtMemo.Text = ds.Tables[0].Rows[0]["memo"].ToString();
            }
        }

        private void btnUpdate_Click(object sender, EventArgs e)
        {
            DataSet ds = oper.GetDataSetUnits();
            if (ds.Tables[0].Rows.Count == 0)
            {
                int i = oper.InsertUnits(txtUnits.Text, txtLinkman.Text, txtUnitsAddress.Text, txtTel.Text, txtMemo.Text);
            }
            else
            {
                int i = oper.UpdateUnits(txtUnits.Text, txtLinkman.Text, txtUnitsAddress.Text, txtTel.Text, txtMemo.Text);
            }
            MessageBox.Show("单位信息--更新成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }
    }
}

⌨️ 快捷键说明

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