I'm trying to update a single record in a database I get this error whenever try to submit the changes though. Method 'System.Object CompareObjectEqual(System.Object, System.Object, Boolean)' has no supported translation to SQL.
What am I doing wrong here?
Using db As New DbClassDataContext
Dim contractTable = (From c In db.Contracts Where c.contractsId = returnId).FirstOrDefault()
contractTable.name = name
db.SubmitChanges()
Using db As New DbClassDataContext
Dim contractTable = (From c In db.Contracts.AsEnumerable() Where c.contractsId = returnId).FirstOrDefault()
contractTable.name = name
db.SubmitChanges()
Using db As New DbClassDataContext
Dim contractTable = (From c In db.Contracts Where c.contractsId = returnId).First()
contractTable.name = name
db.SubmitChanges()
mandrews1234
Member
335 Points
579 Posts
Can't update record
Dec 03, 2012 08:39 PM|LINK
I'm trying to update a single record in a database I get this error whenever try to submit the changes though. Method 'System.Object CompareObjectEqual(System.Object, System.Object, Boolean)' has no supported translation to SQL.
What am I doing wrong here?
Using db As New DbClassDataContext
Dim contractTable = (From c In db.Contracts Where c.contractsId = returnId).FirstOrDefault()
contractTable.name = name
db.SubmitChanges()
End Using
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Can't update record
Dec 04, 2012 03:42 AM|LINK
Hello,
Try this method:
raju_mab
Member
559 Points
110 Posts
Re: Can't update record
Dec 04, 2012 04:41 AM|LINK
Hi use First() instead of FirstOrDefault()
http://msdn.microsoft.com/en-us/vstudio/bb737928#updsimp
mandrews1234
Member
335 Points
579 Posts
Re: Can't update record
Dec 04, 2012 02:36 PM|LINK
asenumerable worked. Using .first gave me the same problem.