See below links for an intro to linq
What is Linq and what does it do?
http://weblogs.asp.net/scottgu/using-linq-to-sql-part-1
Linq provides a mean of querying data, but you still need to provide a means of Linq accessing that data - be it through Linq2Sql classes, ADO, Entity Framework, etc.
I'm a fan of Entity Framework (EF) where you set up objects that represent your data, and use a context to populate those objects.
it could look something like this:
public class Table1
{
public string FirstName { get; set; }
public string SurName { get; set; }
public DateTime DOB { get; set; }
}
public class Table1Repository
{
private readonly MyEntities _context;
public Table1Repository()
{
this._context = new MyEntities();
}
public IQueryable<Table1> Get()
{
return this._context.Table1; // in effect your "Select * from table1"
}
public IQueryable<Table1> GetById(DateTime dob)
{
return this._context.Table1.Where(w => w.DOB == dob); // pulls records with a dob matching param - using lambda here but there is also "query expression syntax" which looks more like sql
}
}
Note that you're performing linq queries on the context that represents the data, not the database itself. Linq is very powerful, but you need to provide it a means of accessing data. Even if that data is as xml, a file, a database, whatever!