private void btnSave_Click(object sender, EventArgs e) { int ChqNo = Convert.ToInt32(txtChequeNo.Text); bool CheckChqNo = db.CheckChequeNo(ChqNo); if (CheckChqNo == true) { MessageBox.Show("This Cheque No Already Added"); } else { Cheque Chq = new Cheque { ChequeNumber = Convert.ToInt32(txtChequeNo.Text), Payee = txtPayee.Text.Trim(), Amount = Convert.ToInt32(txtAmount.Text), DueDate = dtpDueDate.Value, PaidBy = txtPaidBy.Text.Trim(), BankName = txtBankName.Text.Trim() }; db.InsertCheque(Collection, Chq); ClearText(); FormLoad(); } }