/// <summary> /// Deletes a row from the doan_MediaTracks table. /// </summary> /// <param name="trackID">The ID of the track.</param> /// <returns>True if a row was deleted.</returns> public static bool Delete(int trackId) { DBMediaFile.DeleteByTrack(trackId); StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_mediatrack "); sqlCommand.Append("WHERE "); sqlCommand.Append("trackid = :trackid "); sqlCommand.Append(";"); NpgsqlParameter[] arParams = new NpgsqlParameter[1]; arParams[0] = new NpgsqlParameter("trackid", NpgsqlTypes.NpgsqlDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = trackId; int rowsAffected = NpgsqlHelper.ExecuteNonQuery( ConnectionString.GetWriteConnectionString(), CommandType.Text, sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
/// <summary> /// Deletes a row from the doan_MediaTracks table. /// </summary> /// <param name="trackID">The ID of the track.</param> /// <returns>True if a row was deleted.</returns> public static bool Delete(int trackId) { DBMediaFile.DeleteByTrack(trackId); StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_MediaTrack "); sqlCommand.Append("WHERE "); sqlCommand.Append("TrackID = @TrackID "); sqlCommand.Append(";"); SqlCeParameter[] arParams = new SqlCeParameter[1]; arParams[0] = new SqlCeParameter("@TrackID", SqlDbType.Int); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = trackId; int rowsAffected = SqlHelper.ExecuteNonQuery( ConnectionString.GetConnectionString(), CommandType.Text, sqlCommand.ToString(), arParams); return(rowsAffected > -1); }