public bool IsInsert(CityBankBO cityBankBo) { DataTable dataTable; string queryString = "SELECT Cheque_Date,Description,Cheque_No,Debit,Credit,Balance FROM SBP_City_Bank_Data WHERE Cheque_Date='" + cityBankBo.ChequeDate + "' AND Description='" + cityBankBo.Description + "' AND Cheque_No='" + cityBankBo.ChequeNo + "' AND Debit='" + cityBankBo.Debit + "' AND Credit='" + cityBankBo.Credit + "'"; //AND Balance='" + cityBankBo.Balance + "'"; try { _dbConnection.ConnectDatabase(); dataTable = _dbConnection.ExecuteQuery(queryString); } catch (Exception exception) { throw exception; } finally { _dbConnection.CloseDatabase(); } if (dataTable.Rows.Count > 0) { return(true); } else { return(false); } }
public void ProcessDatabase(CityBankBO citybankBo) { string QueryString = ""; QueryString = "INSERT INTO SBP_City_Bank_Data(Cheque_Date,Description,Cheque_No,Debit,Credit,Balance)" + " VALUES('" + citybankBo.ChequeDate + "','" + citybankBo.Description + "','" + citybankBo.ChequeNo + "','" + citybankBo.Debit + "', '" + citybankBo.Credit + "','" + citybankBo.Balance + "')"; try { _dbConnection.ConnectDatabase(); _dbConnection.StartTransaction(); _dbConnection.ExecuteNonQuery(QueryString); _dbConnection.Commit(); } catch (Exception exception) { _dbConnection.Rollback(); throw exception; } finally { _dbConnection.CloseDatabase(); } }