garvit gupta
garvit gupta

Reputation: 303

Linq to Sql Connectivity

I am trying to fire a simple query of Linq

            var user = (from u in Users
                        where u.Username == 'ABC'
                        && u.Password == 'ABC'
                        select u).SingleOrDefault();

My problem is that the table Users is inside my SqlServer 2008 R2. How I manage to call this table from Sql and use in my Linq Query. I google a lot on this topic but not find any satisfactory answer. Please help.

Upvotes: 1

Views: 112

Answers (1)

Akrem
Akrem

Reputation: 4652

if i understand correctly you have to use Linq to sql class and choose your DataBase

you can use this tutorial http://www.codeproject.com/Articles/26657/Simple-LINQ-to-SQL-in-C

edit

you have to add new element to your project, in Data : choose classes LINQ to SQL and in server Explorer make the chose of your database

I found this tutorial for all steps

Upvotes: 1

Related Questions