Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Linq to delete or remove a record

Avatar of deanlee17
deanlee17 asked on
.NET ProgrammingC#LINQ Query
16 Comments1 Solution427 ViewsLast Modified:
Hi guys,

I was following Julia Lermans book on DbContext, she uses the remove command, but I cant. So this works fine for me and the record is removed from the database

 using (var anything = new AscentEntities())
               {
                   var something = (from d in anything.Qte_Lines where d.LinesID == 49 select d).Single();
                   anything.Qte_Lines.DeleteObject(something);
                   anything.SaveChanges();
               }

but if I change .DeleteObject to .Remove I get an error. She seeme to use the remove command with no problems in the examples.

Thanks,
Dean.
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Commented:
This problem has been solved!
Unlock 1 Answer and 16 Comments.
See Answers