Using Where With SubSonic Collection

collectionssubsonic

I am having problem with collection object. Here is the code

CarCollection obj=new CarCollection();
obj.Where("Id","10");
obj.Load();

The problem is the result of the records doubles i.e actually there is only 1 record with the id 10 but it returns 2 same records. Please Help me as i am a newbie.

Thanks

Best Answer

You should be able to do this with the following query:

CardCollection cards = new Select()
  .From(Card.Schema)
  .Where(Card.IdColumn).IsEqualTo(10)
  .ExecuteAsCollection<CardCollection>();

I'd suggest you have a look at the query docs to see some examples of SubSonic queries:

http://subsonicproject.com/docs/Simple_Query_Tool