private void btnMake_Click(object sender, EventArgs e) { try { dbHelper.OpenConn(); if (!String.IsNullOrEmpty(this.txtNewPath.Text)) { if (new SqlCommand("UPDATE resoure_path SET resoure_path='" + this.txtNewPath.Text + "' WHERE resoure_type='main'", dbHelper.Conn).ExecuteNonQuery() == 1) { MessageBox.Show("修改成功!!!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("修改失败!!!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("请填写完整的信息!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { dbHelper.CloseConn(); } FrmAdminMain.Load_SourcePath(); }
//登录按钮 private void button1_Click(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); sb.AppendLine("select * from admin__info "); sb.AppendFormat("where admin_pwd= '{0}' and admin_name={1}", txtpwd.Text, txtname.Text); SqlCommand comm = new SqlCommand(sb.ToString(), dbhelper.Conn); try { dbhelper.OpenConn();//打开数据库 int i = Convert.ToInt32(comm.ExecuteScalar()); if (Yan()) { if (i > 0) { FrmAdminMain frmAdminMain = new FrmAdminMain(); frmAdminMain.Show(); this.Hide(); } else { MessageBox.Show("用户名或密码错误!"); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { dbhelper.CloseConn();//关闭数据库 } }