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; i'm using asp.net 4.5 on windows 7 (x64) i also include:
<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.
What is your Entity set file extension
? If it is dbml
then it will work else not in case of dbmx
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.