I'm using C#/Mono to access a Sqlite db.
The following query works fine in any database app, but DataTable keeps complaining when I try to load the results.
Here's a snippet
cmd.CommandText = @"SELECT
sectors.name AS sector_name,
domains.name AS domain_name
FROM
sectors_domains
INNER JOIN domains ON (sectors_domains.domain = domains.id)
INNER JOIN sectors ON (sectors_domains.sector = sectors.id)";
using (var rdr = cmd.ExecuteReader())
{
using (DataTable dt = new DataTable())
{
dt.load(rdr)
}
}
This throws an error:
ConstraintException: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
The fields being selected (ie, both .name fields in the respective tables) are constrained as Unique and Non-null.