[英]Linq error: not contain a definition for 'InsertOnSubmit'
I have following code: 我有以下代码:
public static bool Update(UserExtendedData data, byte[] image)
{
data.UserId = getUserId_new();
IQueryable<UserExtendedData> entry = m_model.UserExtendedDataSet.Where(x => x.UserId == getUserId_new());
UserExtendedData User = entry.Single();
User.firstName = data.firstName;
User.lastName = data.lastName;
User.phoneNo = data.phoneNo;
User.creditCardNo = data.creditCardNo;
User.dateOfBirth = data.dateOfBirth;
User.UserId = getUserId_new();
if (image != null)
{
User.avatarArt = image;
}
m_model.UserExtendedDataSet.InsertOnSubmit(data);
return true;
}
I have include using System.Data.Linq; 我包括使用System.Data.Linq; i'm using asp.net 4.5 on windows 7 (x64) i also include:
我在Windows 7(x64)上使用asp.net 4.5我还包括:
<compilation debug="true" targetFramework="4.5">
but i still got error: 但我仍然有错误:
does not contain a definition for 'InsertOnSubmit' and no extension method 'InsertOnSubmit' accepting a first argument of type ' could be found (are you missing a using directive or an assembly reference?)
But what is weird i got no problems with: 但奇怪的是我没有遇到任何问题:
public static bool Insert(UserExtendedData data, byte[] image)
{
data.UserId = getUserId_new();
if (image != null)
data.avatarArt = image;
m_model.UserExtendedDataSet.Add(data) ;
m_model.SaveChanges();
return true;
}
Do you have any ideas what could cause this problem ? 你有什么想法会导致这个问题吗? I will really appreciate any help.
我真的很感激任何帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.