基本信息
源码名称:管理系统带单位换算
源码大小:1.72M
文件格式:.rar
开发语言:C#
更新时间:2016-03-22
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

代码,拥有单位换算

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace UILMenu
{
    public partial class addflat : Form
    {
        public addflat()
        {
            InitializeComponent();
        }

        private void tsbtnBaoCun_Click(object sender, EventArgs e)
        {
            if(!(textBox1.Text.Equals("")||textBox2.Text.Equals(""))){
            string sql = "SELECT MAX(tb_flat.class) FROM tb_flat";
            string classs = "",flatname="";
            MySqlConnection mycon = MysqlConn.MysqlConn.Conn();
            mycon.Open();
            MySqlCommand cmd = new MySqlCommand(sql, mycon);
            MySqlDataReader reader = cmd.ExecuteReader();
            while (reader.Read())
            {

                classs = reader.GetString(0);
            }
            reader.Close();
            mycon.Close();

            classs = (int.Parse(classs)   1).ToString();
            string sql2 = "SELECT tb_flat.flatName FROM tb_flat where flatName='"   textBox1.Text   "'";
            mycon = MysqlConn.MysqlConn.Conn();
            mycon.Open();
            cmd = new MySqlCommand(sql2, mycon);
            reader = cmd.ExecuteReader();
            while (reader.Read())
            {

                flatname = reader.GetString(0);
            }
            reader.Close();
            mycon.Close();

            if (!flatname.Equals(""))
            {
                MessageBox.Show("已经存在该单位!!!");

            }
            else {
                String flatID = DateTime.Now.ToFileTimeUtc().ToString();
                if (textBox1.Text != null) {

                    string sql3 = "insert into tb_flat(flatID,flatNum,flatName,flatIde,class) values('"   flatID   "','"   textBox1.Text   "','"   textBox2.Text   "','1','"   classs   "')";
                   int f= updata.add(sql3);
                    if(f==1){
                     //   MessageBox.Show("1");
                    }
                      
                }
                if (textBox3.Text != null)
                {
                    string sql4 = "insert into tb_flat(flatID,flatNum,flatName,flatIde,class) values('"   flatID   "','"   textBox3.Text   "','"   textBox4.Text   "','2','"   classs   "')";
                  int k=  updata.add(sql4);
                     if(k==1){
                      //   MessageBox.Show("1");
                    }
                }
                if (textBox5.Text != null)
                {
                    string sql5 = "insert into tb_flat(flatID,flatNum,flatName,flatIde,class) values('"   flatID   "','"   textBox5.Text   "','"   textBox6.Text   "','3','"   classs   "')";
                    int j = updata.add(sql5);
                    if (j == 1)
                    {
                       // MessageBox.Show("1");

                    }
                }
                else {


                    MessageBox.Show("输入单位!!!从小到大");
                
                
                
                }
                }
            
            
            
            }

        }
        
        
        
    }
}