how can i do like this sql

Posts   
 
    
heyu52
User
Posts: 21
Joined: 27-Apr-2010
# Posted on: 15-Jun-2010 09:38:24   

select b.keepstock from Stock a left join producttype b on a.com_id=b.com_id and a.pt_code=b.pt_code where a.com_id ="ABC" AND and a.item_code = "A01"

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 15-Jun-2010 09:55:25   

Use a DynamicList to fetch one field, and supply a JoinHit.Left when specifying the relation between Stock and ProductType.

heyu52
User
Posts: 21
Joined: 27-Apr-2010
# Posted on: 15-Jun-2010 10:57:54   

can you give a example,it's different the example http://www.llblgen.com/documentation/2.6/hh_start.htm#Using the generated code/Adapter/Using TypedViews, TypedLists and Dynamic Lists/gencode_usingdynamiclists_adapter.htm

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 15-Jun-2010 12:14:40   

It's not that different really...!

From memory, but something like


DataAccessAdapter adapter = new DataAccessAdapter();
ResultsetFields fields = new ResultsetFields(1);
fields.DefineField(ProductTypeFields.KeepStock, 0);

IRelationPredicateBucket bucket = new RelationPredicateBucket();
bucket.Relations.Add(StockEntity.Relations.ProductTypeEntityUsingComId, JoinHint.Left);

bucket.PredicateExpression.Add(StockFields.ComID=="ABC");
bucket.PredicateExpression.Add(StockFields.ItemCode=="A01");

DataTable dynamicList = new DataTable();
adapter.FetchTypedList(fields, dynamicList, bucket, 0, null, true);

should get you started. Have a go and let us know if you have any specific problems.

Matt