Search code examples
c#asp.netlinq-to-sql

Linq to SQL - What am i missing?


I'm a complete newbie to LINQ, so please bare with my stupid questions.

Using Visual Studio I've created a DBML file, and added a table to it from a local database. This created a data context called UserDataContext. In my ASPX page I can create an instance of the data context using:

UserDataContext db1 = new UserDataContext();

However when I try to query against the table I get to:

var query = from o in db1. 

and from there I can't see the table.... the dbml shows the table has public access.

Any ideas what I've missed?


Solution

  • UserDataContext db1 = new UserDataContext();
    var query = from o in db1
                where o.fieldName = "abc"
                select p;