Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

Need 99-level help with Linq 2 Sql

$
0
0

I created a console app, added the new item "LINQ to SQL classes", and dragged the single table Northwind\Customer from Server Explorer to the design pane. (The dbml file is shown below).  I'm trying to use the code below to iterate over the Customer table but am lost.  In the "var CustQuery" statement VS complains that it "Could not find an implementation of the Query pattern for the source type ConsoleApplication1. Customer."  What? Any help much appreciated.

edm2

using System;

using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { DataClasses1DataContext db = new DataClasses1DataContext(); var CustQuery = from cust in Customer select cust; foreach (Customer cust in CustQuery) { Console.WriteLine("{0}", cust.City); } } } }


DBML:


Viewing all articles
Browse latest Browse all 21115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>