I have found something here.
If I execute the test query I did. This is suppose to retrieve two records. If I select one field, which is the master table primary key, which should be the same, I will have the error. If I select one field, and use the relationship table foreign key instead, I will not have the error. This is ridiculous. I should be allowed to select my master field in the query.
Also, as I said, this only happens from my application. From the SSMS interface, it works.
So, I put back the regular code. I ended up in the same problem. As soon as I removed the primary key of the master tables in the list of fields to be retrieve, it worked. But, again, this is ridiculous. I need to be able to select that field in my query result.
What am I missing?