Esempio n. 1
0
        private void Key(object sender, KeyPressEventArgs e)//各编辑框响应的键盘按键
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                string str;
                if (UId == null)
                {
                    str = "insert into DMetric values('" + txtCode.Text + "','" + txtName.Text + "', 0)";
                }
                else
                {
                    str = "insert into DMetric values('" + txtCode.Text + "','" + txtName.Text + "'," + UId + ")";
                }

                FormMetric form1 = (FormMetric)this.Owner;
                db.SetPIVAsDB(str);
                form1.addRow(txtCode.Text, txtName.Text, cbbPName.Text, UId);
                this.Close();
            }
        }
Esempio n. 2
0
        private void btnAdd_Click(object sender, EventArgs e)//数据库内增加计量单位
        {
            string str;

            if (UId == null)
            {
                str = "insert into DMetric values('" + txtCode.Text + "','" + txtName.Text + "', 0)";
            }
            else
            {
                str = "insert into DMetric values('" + txtCode.Text + "','" + txtName.Text + "'," + UId + ")";
            }

            FormMetric form1 = (FormMetric)this.Owner;

            db.SetPIVAsDB(str);
            form1.addRow(txtCode.Text, txtName.Text, cbbPName.Text, UId);

            this.Close();
        }