Hinli
0
Q:

linq select if different null

db.UserAdresses.Where(p => p.UserID == guid && p.PostalCode != null)
0
            using (MyTestDBEntities context = new MyTestDBEntities())
            {
                var query = context.UserTables.Where(p => p.City != null)
                    .Select(cc => new { DisplayValue = cc.UserID, DisplayText = cc.FirstName + "  " + cc.LastName + "  " + cc.City });

                DropDownList1.DataSource = query.ToList();
                DropDownList1.DataTextField = "DisplayText";
                DropDownList1.DataValueField = "DisplayValue";
                DropDownList1.DataBind();
            }
0

New to Communities?

Join the community