Exemple #1
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            CamtasiaInfoForm cf = new CamtasiaInfoForm();

            CamtasiaInfoForm.UserName  = UserName;
            CamtasiaInfoForm.UserPower = UserPower;
            cf.Show();
        }
Exemple #2
0
        private void btnAccept_Click(object sender, EventArgs e)
        {
            //获取界面上输入
            string txtNO   = this.txtNO.Text;//此处为系统自动赋值,无须用户输入
            string txtName = this.txtName.Text;

            if (txtName == "")
            {
                MessageBox.Show("仓库名称不能为空!");
                this.txtName.Focus();
                return;
            }
            SqlConnection conn = null;

            try
            {
                conn = new SqlConnection(DBHelper.ConnString);
                conn.Open();
                string     sqlstr = string.Format("insert into Storage(StorageName) values ('{0}')", txtName);
                SqlCommand cmd    = new SqlCommand(sqlstr, conn);
                int        rows   = cmd.ExecuteNonQuery();
                if (rows > 0)
                {
                    MessageBox.Show("添加成功");
                    this.Close();
                    //刷新
                    CamtasiaInfoForm cg = new CamtasiaInfoForm();
                    //cg.lvCamtasiaInfoLoad();
                    //CamtasiaInfoForm.ActiveForm
                }
                else
                {
                    MessageBox.Show("添加失败");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("添加仓库出现异常!\n原因:" + ex.Message);
            }
            conn.Close();
            //  this.Close();
        }