DeleteObject方法不会删除任何内容 - 请帮忙。(DeleteObject method doesn't delete anything - please help.)

   IT问题网   2021-03-12 00:00:00

问 题




 console.writeline(" 请输入您要删除的订单id"); 
int choice3 = int .parse(到console.readline());
var ordertodelete =( from c in db.orders
其中 c.orderid == choice3
选择 c).firstordefault();

if (ordertodelete!= null
var orderexists =( from c in db.orders
其中 c.orderid == choice3
选择 c).firstordefault();
if (orderexists!= null
console。 writeline(" 订单未删除。");
console.writeline(" 订单已删除。");


您不能保存(提交)更改,以确保它们是没有保存。如果你已经阅读过这些文档,你就会知道文档中有示例代码: objectcontext.deleteobject[ ^ ]


非常感谢。我是笨蛋。 :)



  • 微信
  • QQ好友
  • QQ空间
  • 新浪微博



problem edit; okay i am creating a dock for programs to r ...

如何在我添加的现有数据表中添加新列,但它是bofore行的结尾(how add new column in existing datatable i added but its is come end of the bofore rows)

problem my datatable contans two columns ; id value ---- ...

在c#和asp.net中使用LinkedIn API?(Working with LinkedIn APIs in c# and )

problem hey i was trying to design an based webs ...

设计模式的案例研究(Case Studies for Design Pattern)

problem hi everyone, though i found "design patterns exp ...

返回所有组件(Retur all components)

problem dears, i need a method to return all named contro ...

Picturebox控件不会触发鼠标事件(Picturebox control not firing mouse events)

problem i have a picturebox control in a groupbox control ...

Windows 7中的 + Crystall报告问题( + Crystall report issue in Windows 7)

problem i have created windows application in 2005 ...

如何将数据表中的数据保存回数据库?(How to save the data in a datatable back into the database)

problem i have filled my datatable with my sqladapter ass ...

测试ip和developpe ip扫描仪(Test ip and developpe ip scanner)

problem hi friends, i want help !!! i need c ...

在.Net中使用WCF的3层(3 tier using WCF in .Net)

problem hi, i have developed a 3 tier application in vb. ...

连续循环不循环(Continual Loop Not Looping)

problem j have code that is suppose to continue looping l ...

vb中的动态按钮控件(Dynamic button control in vb)

problem hi, i''ve a 10x10 matrix of buttons. i need to c ...

动态创建按钮的事件处理程序(event handler for dynamically created buttons)

problem i''ve created 100 buttons dynamically. but how to ...

电子邮件提醒新文章评论(Email alert for new article comments)

problem hi, i recently posted a couple of articles to c ...

在 3.5中创建第三方组件(creating third party component in 3.5)

problem i am already created a chat application. now i wa ...

查询以显示指定月份和前一个月的两个表中的匹配记录(query to show matching records from two tables for a specified month and one month prior)

problem hi, i need to show matching records ...

日期在sqlserver中的表中自动增加(date increasing automatically in the table in sqlserver)

problem sir how to increase the date in the table automat ...

将RTF文件转换为Dataridview?有可能的? VB.NET(Convert RTF file to Dataridview It is Possible VB.NET)

problem i want to convert rtf file in datagridview it is ...

获取具有相同颜色的图像中的像素数。(get the count of pixels in an image with the same color.)

problem i need to get the number of pixels that contains ...

如何在asp.net中使用divpopup(How to use divpopup in

problem hi , i want know how to use ppopup in webforms li ...