Linq to SQL中的错误 [英] error in Linq to SQL

查看:79
本文介绍了Linq to SQL中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即时通讯参考:Microsoft.press.microsoft.ado.net.4.step.by.step.oct.2010
我试图将linq转换为sql,但出现此错误:类型"ADODOTNET.Emp"未映射为表."

im refering: Microsoft.press.microsoft.ado.net.4.step.by.step.oct.2010
I was trying linq to sql, but i get this error:"The type ''ADODOTNET.Emp'' is not mapped as a Table."

public class SalesOrder : DataContext
{
        // ----- Constructor establishes database connection.
        public SalesOrder(string connectionString) : base(connectionString) { }
        // ----- Table definitions to link with database.
        public Table<Emp> Employee;

}



Emp表有4个列:
ID
fname
Lname
薪金

我在linq查询下面射击:



Emp table has 4 coloumns:
ID
fname
Lname
Salary

I was firing below linq query:

using (SalesOrder context = new SalesOrder(linkToDB.ToString()))
            {
                var linqresult = from cu in context.Employee
                                 select new { CustomerID = cu.ID, CustomerName = cu.LNAME };
            }

推荐答案

This[^] is the best thing to do when you need help with a specific error message.


这篇关于Linq to SQL中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆