private void simpleButtonOK_Click(object sender, EventArgs e) { ConnDB conn = new ConnDB(); string strsql; strsql = "insert into COST_EXPENSE(CTYPE,TYPE_DES,CMONTH,EXPENSE,NOTE) values('" + comboBoxType.SelectedValue.ToString() + "','" + comboBoxType.Text.ToString() + "','" + dateTimePickerMonth.Text.ToString() + "','" + Common.IsNull(textEditExpense.Text.ToString().Trim()) + "','" + textEditNote.Text.ToString().Trim() + "')"; if (textEditExpense.Text.ToString().Trim() != "") { bool isok = conn.EditDatabase(strsql); if (isok) { MessageBox.Show("添加成功!"); TempEmpExpenseQuery.RefreshEX(); this.Close(); } else { MessageBox.Show("失败!"); } } else { MessageBox.Show("费用金额不能为空!"); } conn.Close(); }
private void simpleButtonOK_Click(object sender, EventArgs e) { ConnDB conn = new ConnDB(); string sql = "update COST_expense set ctype = '" + comboBoxType.SelectedValue.ToString() + "',type_des = '" + comboBoxType.Text.ToString() + "',cmonth='" + dateTimePickerMonth.Text + "',expense='" + Common.IsNull(textEditExpense.Text.ToString().Trim()) + "',note='" + textEditExpense.Text.ToString().Trim() + "'"; sql = sql + " where cid = '" + id + "'"; bool isok = conn.EditDatabase(sql); if (isok) { MessageBox.Show("修改成功!"); TempEmpExpenseQuery.RefreshEX(); this.Close(); } else { MessageBox.Show("失败!"); } conn.Close(); }
private void barButtonItem刷新_ItemClick(object sender, ItemClickEventArgs e) { TempEmpExpenseQuery.RefreshEX(); }