Problem: I have to check whether or not a record exists in a join
and if not ignore that user but still load all the other information for that user
var db = Simple.Data.Database.OpenNamedConnection("sqlConn");
02
03 var expr1 = db.PON_APP_USERS.STATUS == 1;
04
05 var sUsers = db.PON_APP_USERS.FindAll(expr1)
06 .Select(
07 db.PON_APP_USERS.USERKEY,
08 db.PON_APP_USERS.LAST_NAME,
09 db.PON_APP_USERS.FIRST_NAME,
10 db.PON_APP_USERS.AGENCY,
11 db.PON_APP_USERS.USERUSERS.CBI_NO,
12 db.PON_APP_USERS.USERUSERS.EXPRNC_STAT_IN,
13 db.PON_APP_USERS.USERUSERS.TEST_STAT_IN,
14 db.PON_APP_USERS.USERUSERS.TWO_WKS_TRNG_DT)
15 .LeftJoin(db.USERUSERS, USERKEY: db.PON_APP_USERS.USERKEY);
I'm new to simple data as in, 2 days new. So if you don't mind showing me step by step it would be greatly appreciated. This is what they are requesting of that join
:
/// If no record is join with the above statement, page will crash. Please make adjustments to allow the page to load if the user does not have a record in USERUSERS table.