public void InsertAuthor(Model.Author oData) { try { scb.ConnectionString = sConnectionString; ddq = new DatabaseQuery.DBQuery(); ddq.ConnectionString = scb.ConnectionString; ddq.CommandText = "INSERT INTO TBL_AUTHOR (FIRST_NAME,MIDDLE_NAME,LAST_NAME) VALUES ('" + oData.FIRST_NAME + "','" + oData.MIDDLE_NAME + "','" + oData.LAST_NAME + "')"; ddq.ExecuteNonQuery(CommandType.Text); } catch (Exception ex) { throw ex; } }
public void UpdateAuthor(Model.Author oData) { try { scb.ConnectionString = sConnectionString; ddq = new DatabaseQuery.DBQuery(); ddq.ConnectionString = scb.ConnectionString; ddq.CommandText = "UPDATE TBL_AUTHOR SET FIRST_NAME = '" + oData.FIRST_NAME + "', MIDDLE_NAME = '" + oData.MIDDLE_NAME + "', LAST_NAME = '" + oData.LAST_NAME + "',STATUS = '" + oData.STATUS + "' WHERE ID = '" + oData.PERSON_ID + "'"; ddq.ExecuteNonQuery(CommandType.Text); } catch (Exception ex) { throw ex; } }
public Boolean isRecordExists(Model.Author oData) { try { scb.ConnectionString = sConnectionString; ddq = new DatabaseQuery.DBQuery(); ddq.ConnectionString = scb.ConnectionString; string sQuery = ""; sQuery = "SELECT * FROM TBL_AUTHOR WHERE FIRST_NAME = '" + oData.FIRST_NAME + " AND MIDDLE_NAME = '" + oData.MIDDLE_NAME + "' AND LAST_NAME = '" + oData.LAST_NAME + "'"; ddq.CommandText = sQuery; ds = ddq.GetDataset(CommandType.Text); return(ds.Tables[0].Rows.Count > 0 ? true : false); } catch (Exception ex) { return(true); } }