public void Update(StudentAbilityBase sa) { CommonFunctions.UpdateApostrophe(sa); StringBuilder sb = new StringBuilder(); sb.Append("UPDATE StudentAbility SET "); sb.Append("Item='" + sa.Item + "'"); sb.Append(",Description='" + sa.Description + "'"); if (sa.Comments != null && sa.Comments != string.Empty) { sb.Append(",Comments='" + sa.Comments + "'"); } else { sb.Append(",Comments=null"); } sb.Append(" WHERE StudentAbilityId =" + sa.StudentAbilityId); string sql = sb.ToString(); dbc.ExecuteCommand(sql); }
public void Add(StudentAbilityBase sa, int StudentId) { CommonFunctions.UpdateApostrophe(sa); StringBuilder sb = new StringBuilder(); sb.Append("INSERT INTO StudentAbility (StudentId,Item,Description,Comments, StudentAbilityTypeId) VALUES ("); sb.Append(StudentId); sb.Append(",'" + sa.Item + "'"); sb.Append(",'" + sa.Description + "'"); if (sa.Comments != null && sa.Comments != string.Empty) { sb.Append(",'" + sa.Comments + "'"); } else { sb.Append(",null"); } sb.Append("," + sa.StudentAbilityTypeId); sb.Append(")"); string sql = sb.ToString(); dbc.ExecuteCommand(sql); }