Newbie Question on Select..

Posts   
 
    
yze
User
Posts: 2
Joined: 02-Aug-2006
# Posted on: 02-Aug-2006 03:53:22   

Hi Everyone! I am currently working on a project using LlblGen v. 2, is there anyone who out there who could help me with sample codes for me to produce this kind of query.

SELECT Table1.*, Table2.FieldName FROM Table1 INNER JOIN Table2 ON Table1.FieldID = Table2.FieldID WHERE FieldID2 = VALUE AND ( -1 = VALUE2 OR FieldTypeID = VALUE2)

That's the general query, if someone could help me with samples on how to pass it using a data table or only through a reader that would be very helpful. Thanks!

Posts: 1268
Joined: 10-Mar-2006
# Posted on: 02-Aug-2006 06:33:44   

What have you tried so far?

yze
User
Posts: 2
Joined: 02-Aug-2006
# Posted on: 02-Aug-2006 08:33:49   

Actually I haven't fully checked the whole features and syntax of Llblgen.

I was checking on the projector and prefetch, the scenario I have was I was given an existing code and I need to convert it using Llblgen.

here is the previous code not yet using Llblgen, now where do I start?



public DataTable QSDatasource(int QSTypeId)
{
    DataTable dt = new DataTable();
    string tablename = BTN();
    dt = Process.Database.ExecuteQueryReturnDataTable("SELECT ",tablename,".*,Table2.Name FROM ",tablename,
        " INNER JOIN Table2 ON ",tablename,".FieldId = Table2.FieldId",
                " WHERE ",BCNW(),
        " AND ( -2 = ",QSTypeId.ToString()," OR QSTypeId = ",QSTypeId.ToString(),") ORDER By ",tablename,".CreationDate DESC");
    return dt;  
}


Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 02-Aug-2006 15:39:51   

For the SELECT part you should decide whether you want to use an Entity for Table1 and a field mapped on related fields for the Table2.Name field. Or you want to use a TypedList, dynamicList or TypedView.

You will find all the explanations you need in the docs, start from "Concepts -> Entities, Typed lists and Typed views"

For the filtering part you should be looking in the docs for "Using the generated code -> Adapter/SelfServicing -> Filtering and sorting"