private void barButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FolderBrowserDialog dialog = new FolderBrowserDialog();

            if (dialog.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                string _path = dialog.SelectedPath;
                string sql   = "update Savepath set savefilepath='" + _path + "' where id=3";
                if (OleHeper.ExecuteSql(sql) > 0)
                {
                    MessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    _SavePath = _path;
                }
            }
        }
        public static bool UpdateBoard(string code, string cname, string Fx, string hole, int id)
        {
            string sql = "update boardinfo set code={0},cname={1},boardFX={2},hole={3}";

            sql = sql + " where id={4}";
            int i = OleHeper.ExecuteSql(string.Format(sql, "'" + code + "'",
                                                      "'" + cname + "'", "'" + Fx + "'", "'" + hole + "'", id));

            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static bool DeleteBoard(int id)
        {
            string sql = "delete boardinfo ";

            sql = sql + " where id=@id";
            List <OleDbParameter> parameters = new List <OleDbParameter>();

            parameters.Add(new OleDbParameter("@id", id));
            int i = OleHeper.ExecuteSql(sql, parameters.ToArray());

            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #4
0
        //保存
        private void button4_Click(object sender, EventArgs e)
        {
            if (System.IO.Directory.Exists(jcpath.Text) == false)
            {
                MessageBox.Show("监测路径不存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (System.IO.Directory.Exists(expath.Text) == false)
            {
                MessageBox.Show("XML导出路径不存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (System.IO.Directory.Exists(bkpath.Text) == false)
            {
                MessageBox.Show("Json备份路径不存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            string sqljc = "update Savepath set savefilepath='" + jcpath.Text + "' where id=2";
            string sqlsa = "update Savepath set savefilepath='" + expath.Text + "' where id=1";
            string sqlbk = "update Savepath set savefilepath='" + bkpath.Text + "' where id=3";

            try
            {
                OleHeper.ExecuteSql(sqljc);
                OleHeper.ExecuteSql(sqlsa);
                OleHeper.ExecuteSql(sqlbk);
                main._SavePath = expath.Text;
                MessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (checkBox1.Checked == true)
                {
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        public static bool InsertBoard(string code, string cname, string Fx, string hole)
        {
            string sql = "insert into boardinfo(code,cname,boardFX,hole)";

            sql = sql + "values (@code,@cname,@boardFX,@hole)";
            List <OleDbParameter> parameters = new List <OleDbParameter>();

            parameters.Add(new OleDbParameter("@code", OleDbType.VarChar, 50, code));
            parameters.Add(new OleDbParameter("@cname", OleDbType.VarChar, 50, cname));
            parameters.Add(new OleDbParameter("@boardFX", OleDbType.VarChar, 50, Fx));
            parameters.Add(new OleDbParameter("@hole", OleDbType.VarChar, 50, hole));
            int i = OleHeper.ExecuteSql(sql, parameters.ToArray());

            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 private void savebtn_Click(object sender, EventArgs e)
 {
     if (Knametxt.Text.Trim().Length != 0 &&
         Inametxt.Text.Trim().Length != 0)
     {
         try
         {
             int count = 0;
             for (int i = 0; i < Listid.Count; i++)
             {
                 string sql = "insert into Paramss(BoardId,Iname,Kname,Remark) values (";
                 sql   = sql + Listid[i] + ",'" + Inametxt.Text.Trim() + "',";
                 sql   = sql + "'" + Knametxt.Text.Trim() + "',";
                 sql   = sql + "'" + remarktxt.Text.Trim() + "'" + ")";
                 count = count + OleHeper.ExecuteSql(sql);
             }
             if (count == Listid.Count)
             {
                 MessageBox.Show("新增成功!", "提示!!!",
                                 MessageBoxButtons.OK, MessageBoxIcon.Information);
                 if (checkBox1.Checked == true)
                 {
                     this.Close();
                 }
             }
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
     else
     {
         MessageBox.Show("变量名未填写完整", "提示!!!",
                         MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }