Ejemplo n.º 1
0
 private void btnSaveConnect_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.IsNull() == true)
         {
             return;
         }
         string          connectstring = "provider=Microsoft.jet.OLEDB.4.0;Data Source=accountsystem.mdb;Jet OleDb:Database Password=lxw618";
         string          sqlcommand    = "update [Set] set [connect]='Data Source=" + txtServer.Text + "\\" + txtCase.Text + ";Initial Catalog=" + txtDatabase.Text + ";User ID=" + txtUsername.Text + ";Password="******"'";
         string          sqlcommand2   = "update [Set] set [server]='" + txtServer.Text + "',[case]='" + txtCase.Text + "',[database]='" + txtDatabase.Text + "',[user]='" + txtUsername.Text + "',[password]='" + txtPassword.Text + "'";
         OleDbConnection aConnection   = new OleDbConnection(connectstring);
         aConnection.Open();
         OleDbCommand aCommand = new OleDbCommand(sqlcommand, aConnection);
         aCommand.ExecuteNonQuery();
         OleDbCommand aCommand2 = new OleDbCommand(sqlcommand2, aConnection);
         aCommand2.ExecuteNonQuery();
         MessageBox.Show("保存成功", "恭喜");
         aConnection.Close();
         this.Close();
         fSC = null;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "系统错误");
     }
 }
Ejemplo n.º 2
0
 private void btnSet_Click(object sender, EventArgs e)
 {
     if (SetConnect.fSC == null)
     {
         SetConnect setconnect = new SetConnect();
         setconnect.Show();
     }
     else
     {
         SetConnect.fSC.Activate();
     }
 }
Ejemplo n.º 3
0
 public SetConnect()
 {
     InitializeComponent();
     fSC = this;
 }
Ejemplo n.º 4
0
 private void picClose_MouseClick(object sender, MouseEventArgs e)
 {
     this.Close();
     fSC = null;
 }