private void btnSet_Click(object sender, EventArgs e) { if (ExchangeRateSet.fERS == null) { ExchangeRateSet frmExchangeRateSet = new ExchangeRateSet(); frmExchangeRateSet.Show(); } else { ExchangeRateSet.fERS.Activate(); } }
private void btnSave_Click(object sender, EventArgs e) { if (txtAfter.Text == "") { MessageBox.Show("汇率不能为空", "输入错误"); return; } try { string strType; if (cmbAfter.Text == "人民币CNY") { strType = "CNY"; } else if (cmbAfter.Text == "欧元EUR") { strType = "EUR"; } else if (cmbAfter.Text == "英镑GBP") { strType = "GBP"; } else if (cmbAfter.Text == "澳元AUD") { strType = "AUD"; } else if (cmbAfter.Text == "日元JPY") { strType = "JPY"; } else { return; } string connectstring = "provider=Microsoft.jet.OLEDB.4.0;Data Source=accountsystem.mdb;Jet OleDb:Database Password=lxw618"; string sqlcommand = "update [ExchangeRateSet] set [" + strType + "]='" + txtAfter.Text + "'"; OleDbConnection aConnection = new OleDbConnection(connectstring); aConnection.Open(); OleDbCommand aCommand = new OleDbCommand(sqlcommand, aConnection); aCommand.ExecuteNonQuery(); MessageBox.Show("保存成功", "恭喜"); aConnection.Close(); this.Close(); fERS = null; } catch (Exception ex) { MessageBox.Show(ex.Message, "系统错误"); } }
private void picClose_Click(object sender, EventArgs e) { this.Close(); fERS = null; }
public ExchangeRateSet() { InitializeComponent(); fERS = this; }