private void btnUpdate_Click(object sender, EventArgs e) { bool bReturn = false; if (m_nID != 0) { bReturn = true; } else { MessageBox.Show("Record is not selected to Update"); } if (bReturn == true) { DialogResult dialogResult = MessageBox.Show("Your are trying to Update record", "Update", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { bReturn = true; } else if (dialogResult == DialogResult.No) { bReturn = false; } } if (bReturn == true) { //string strQuery = // "UPDATE " // + m_strTableName // + " SET " // + m_strFirstName + "=" + "'" + txtFirstName.Text + "', " // + m_strMiddleName + "=" + "'" + txtMiddleName.Text + "', " // + m_strLastName + "=" + "'" + txtLastName.Text + "', " // + m_strAddress + "=" + "'" + txtAddress.Text + "', " // + m_strPhone + "=" + "'" + txtPhoneNo.Text + "'" // + " WHERE " // + m_strID + "=" + m_nID // ; string strQuery = SingletonSonar.Instance.CustomerUpdateQuery(txtFirstName.Text, txtMiddleName.Text, txtLastName.Text, txtAddress.Text, txtPhoneNo.Text, m_nID); bReturn = dbConnect.Update(strQuery); if (bReturn == true) { MessageBox.Show("Record Updated"); ClearData(); DisplayData(); } } }
//private string InsertStatement(int nCategoryId, string strText) //{ // return "INSERT INTO " // + m_strTableName // + "(" // + m_strCategoryID + "," // + m_strValue + "," // + m_strModifiedOn // + ") VALUES(" // + nCategoryId + ", " // + strText + ", " // + "'" + m_strModifiedOnValue + "'" // + ")"; //} //private string UpdateStatement(int nCategoryId, string strText) //{ // return "UPDATE " // + m_strTableName // + " SET " // + m_strValue + "=" + "'" + strText + "'" // + " WHERE " // + m_strCategoryID + "=" + nCategoryId // + " AND " + m_strTableName + "." + m_strModifiedOn + " = '" + m_strModifiedOnValue + "'"; //} private void btnUpdate_Click(object sender, EventArgs e) { bool bReturn = false; if (m_nID != 0) { bReturn = true; } else { MessageBox.Show("Record is not selected to Update"); } if (bReturn == true) { DialogResult dialogResult = MessageBox.Show("Your are trying to Update record", "Update", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { bReturn = true; } else if (dialogResult == DialogResult.No) { bReturn = false; } } if (bReturn == true) { //m_strModifiedOnValue = DateTime.Now.ToString("yyyy-MM-dd"); //string strQuery = // "UPDATE " // + m_strTableName // + " SET " // + m_strValue + "=" + "'" + txtValue.Text + "', " // + m_strModifiedOn + "=" + "'" + m_strModifiedOnValue + "'" // + " WHERE " // + m_strID + "=" + m_nID // ; string strQuery = SingletonSonar.Instance.SettingUpdateQuery(m_nID, txtValue.Text); bReturn = dbConnect.Update(strQuery); if (bReturn == true) { MessageBox.Show("Record Updated"); ClearData(); DisplayData(); } } }
private void btnUpdate_Click(object sender, EventArgs e) { bool bReturn = false; if (m_nID != 0) { bReturn = true; } else { MessageBox.Show("Record is not selected to Update"); } if (bReturn == true) { DialogResult dialogResult = MessageBox.Show("Your are trying to Update record", "Update", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { bReturn = true; } else if (dialogResult == DialogResult.No) { bReturn = false; } } if (bReturn == true) { //string strQuery = // "UPDATE " // + m_strTableName // + " SET " // + m_strName + "=" + "'" + txtName.Text + "', " // + m_strDetails + "=" + "'" + txtDetails.Text + "', " // + m_strCategory + "=" + "'" + cmbCategory.Text + "'" // + " WHERE " // + m_strID + "=" + m_nID // ; string strQuery = SingletonSonar.Instance.ProductUpdatetQuery( txtName.Text, txtDetails.Text, cmbCategory.Text, m_nID); bReturn = dbConnect.Update(strQuery); if (bReturn == true) { MessageBox.Show("Record Updated"); ClearData(); DisplayData(); } } }
private void btnUpdate_Click(object sender, EventArgs e) { bool bReturn = false; if (m_nID != 0) { bReturn = true; } else { MessageBox.Show("Record is not selected to Update"); } if (bReturn == true) { DialogResult dialogResult = MessageBox.Show("Your are trying to Update record", "Update", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { bReturn = true; } else if (dialogResult == DialogResult.No) { bReturn = false; } } if (bReturn == true) { string strQuery = SingletonSonar.Instance.EmployeeUpdateQuery(txtCode.Text, txtFirstName.Text, txtMiddleName.Text, txtLastName.Text, txtAddress.Text, txtPhoneNo.Text, m_nID); bReturn = dbConnect.Update(strQuery); if (bReturn == true) { MessageBox.Show("Record Updated"); ClearData(); DisplayData(); } } }
private void btnUpdate_Click(object sender, EventArgs e) { bool bReturn = false; if (m_nEmployeeID != 0) { bReturn = true; } else { MessageBox.Show("Record is not selected to Update"); } if (bReturn == true) { DialogResult dialogResult = MessageBox.Show("Your are trying to Update record", "Update", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { bReturn = true; } else if (dialogResult == DialogResult.No) { bReturn = false; } } if (bReturn == true) { string strQuery = SingletonSonar.Instance.EmployeeUpdatetQuery( dtpStartDate.Value.Date.ToString("yyyy-MM-dd"), dtpEndDate.Value.Date.ToString("yyyy-MM-dd"), m_nID); bReturn = dbConnect.Update(strQuery); if (bReturn == true) { MessageBox.Show("Record Updated"); ClearData(); DisplayData(); } } }
private void btnPay_Click(object sender, EventArgs e) { bool bReturn = false; if (m_nID != 0) { bReturn = true; } else { MessageBox.Show("Record is not selected to Update"); } if (bReturn == true) { //string strQuery = // "UPDATE " // + m_strTableInvoice // + " SET " // + m_strPayment1 + "=" + "'" + txtPayment1.Text + "', " // + m_strPayment2 + "=" + "'" + txtPayment2.Text + "'" // + " WHERE " // + m_strInvoiceID + "=" + m_nID // ; string strQuery = SingletonSonar.Instance.InvoiceUpdateQuery( txtPayment1.Text, txtPayment2.Text, m_nID); bReturn = dbConnect.Update(strQuery); if (bReturn == true) { MessageBox.Show("Record Updated"); //ClearData(); DisplayData(); } } }
//Update button is clicked private void bUpdate_Click(object sender, EventArgs e) { dbConnect.Update(); }