Example #1
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string err = string.Empty;
                sb.Length = 0;
                sb.AppendFormat("'{0}',", txttestunit.Text.Trim());
                sb.AppendFormat("'{0}',", txtTestunitAddr.Text.Trim());
                sb.AppendFormat("'{0}',", txtuser.Text.Trim());
                sb.AppendFormat("'{0}',", txtdetectunitname.Text.Trim());
                sb.AppendFormat("'{0}',", txtdetectNature.Text.Trim());
                sb.AppendFormat("'{0}',", txtProductAddr.Text.Trim());
                sb.AppendFormat("'{0}'", ProductUnit.Text.Trim());

                int rt = sql.SaveInformation(sb.ToString(), out err);
                if (rt == 1)
                {
                    MessageBox.Show("数据保存成功", "提示");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
                return;
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }