daily pastebin goal
23%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ASP.net LINQ: return items where id equals a variable
  2. var result = (from b in dc.Businesses
  3.                   select b).ToList();
  4.     return result;
  5.    
  6. var result = (from b in dc.Businesses where b.BusinessType == aVariableValue
  7.                   select b).ToList();
  8.     return result;
  9.    
  10. public void Button1_Click(object sender, EventArgs e)
  11. {
  12.     var keuze = "Nachtwinkel";
  13. }
  14.    
  15. public IList<Business> selectAll()
  16. {
  17.     var result = (from b in dc.Businesses where b.BusinessType == keuze
  18.                   select b).ToList();
  19.     return result;
  20. }
  21.    
  22. public void Button1_Click(object sender, EventArgs e)
  23. {
  24.      Session["keuze"] = "Nachtwinkel";
  25. }
  26.  
  27. public IList<Business> selectAll()
  28. {
  29.     var result = (from b in dc.Businesses where b.BusinessType == Session["keuze"]
  30.                   select b).ToList();
  31.     return result;
  32. }
  33.    
  34. //this line in your OnClick function
  35. keuze = "MyBusinessTypeName";
  36.  
  37. //this line in your data handler
  38. var result = (from b in dc.Businesses where b.BusinessType.BusinessTypeName == keuze
  39.               select b).ToList();
  40.    
  41. public bool FilterByBusinessTypeID(dc.Business dcBusiness)
  42. {
  43.    return dcBusiness.ID == anIdVariable;
  44. }
  45. var result= BusinessType.Where(FilterByBusinessTypeID).First();
  46.    
  47. var result = (from b in dc.Businesses where b.BusinessType.Id == anIdVariable
  48.               select b).ToList();
  49. return result;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top