Does this query the table, select the data and store it in db for later reference?
or
Is that a pointer to the query that will select the data form the table?
or
Am i wrong on all accounts

db isn't really a "pointer", and you shouldn't call it as such to avoid confusion with people who think you mean a literal C pointer, but otherwise yes (so the second one). LINQ with databases typically does not execute queries until you try to use their results. Even if you build a query with the various methods available, it doesn't execute until later.

Originally Posted by dsfx

Also i need to specify a time frame to select so i'm not querying the whole database every time the page is loaded. I tried to do this with LINQ but was unable to specify any columns.

What code did you try? Are you using the LINQ keywords (from/where/select/etc.) or the methods (like .Where and .Select)?

Thank you for straightening that out for me. I want to give LINQ a chance, i'm just frustrated so far it feels like there is this layer of abstraction above the HTML/SQL in .NET and it muddies the waters. I come from an Angular/Coldfusion background and it just felt like i was one layer closer to the code. But again it could just be frustration from learning haha.

Anyways I see where I went wrong with my LINQ statement, it was a stupid mistake. But when i plug the statement you gave me it underlines the Month in res.start.Month. Note it does state that i may be missing a directive or assembly. I did a look up on the requirements and i'm sure i've got everything!

Here is a list of what i'm using:

Code:

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using partTimeCalendar;
using System.Web.Script.Serialization;
using Newtonsoft;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

I think i have it all in there, i don't know what i'm missing or doing wrong.

Here is the problem for reference:

Code:

var results = from res in db.reservations
where res.start.Month = myDate.Month // currentMonth is a variable you have
select res;

I get an error saying "Property of indexer 'DateTime.Month' cannot be assigned to -- it is read only" From what i'm reading this is caused by not having a set option on the method(proper terminology?). As you can see here i clearly do, i don't know what else would cause this to happen.