/// <summary>
/// Deletes all data records associated with a data record ID
/// </summary>
/// <param name="DataID">Data ID record</param>
public static void DeleteDataLabels(int DataId)
{
using (var dc = new ArtworkingDataContext())
{
// Delete associated datalabels
var q = dc.tblArtworkDataLabels.Where(c => c.dataID == DataId);
if (q.Count() != 0)
{
dc.tblArtworkDataLabels.DeleteAllOnSubmit(q);
dc.SubmitChanges();
}
}
}
If there are records to delete in the DB, it throws:
Exception Details: System.Data.SqlClient.SqlException: The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.
On
dc.SubmitChanges();
Bit confused about this one!