dc

dc

  • NA
  • 663
  • 0

C# linq to sql issue

Feb 12 2013 11:48 AM
I am in the process of wanting to debug a C# 2008 linq to sql statment and I am having the following problem:

I am looking at the reference located at:

http://msdn.microsoft.com/en-us/library/bb386930.aspx

Where the code is the following:

// using System.Data.Common;
Northwnd db = new Northwnd(@"c:\northwnd.mdf");

var q =
    from cust in db.Customers
    where cust.City == "London"
    select cust;

Console.WriteLine("Customers from London:");
foreach (var z in q)
{
    Console.WriteLine("\t {0}",z.ContactName);
}

DbCommand dc = db.GetCommand(q);
Console.WriteLine("\nCommand Text: \n{0}",dc.CommandText);
Console.WriteLine("\nCommand Type: {0}",dc.CommandType);
Console.WriteLine("\nConnection: {0}",dc.Connection);

Console.ReadLine();

For the line of code that says,"Northwnd db = new Northwnd(@"c:\northwnd.mdf");",

How should I  a point that to a table in a sql server 2008 r2 database called 'main' on a server called 'servertest' on a database called 'dev'?


Answers (1)