如何在实体框架中更新行

编程入门 行业动态 更新时间:2024-10-27 12:31:42
本文介绍了如何在实体框架中更新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

0 下来投票 最爱 i我正在制作pos软件,现在我的客户要求的是他们在列表框中添加2项2次所以它只是显示一次,但这个项目的数量增加我正在努力,但我不知道如何处理数量。

0 down vote favorite i am making a pos software and now my clients request is when they add 1 items 2 times in listbox so it's just show one time but quantity of this item increase i am working on this but i dont know how to work on quantity.

Button b = (Button)sender; tblProduct tp = (tblProduct)b.Tag; string product = tp.productName; lbProductsToBuy.Text = tp.ToString(); products.Add(tp); total += (decimal)tp.productPrice; var duplicates = products.GroupBy(i => i.productName) .Where(x => x.Count() > 0) .Select(val => val.Key); foreach (var item in duplicates) { } and listbox format is try { string ProductName = ((tblProduct)e.ListItem).productName; string Price = "Rs: " + String.Format("{0:}", ((tblProduct)e.ListItem).productPrice); string ProductNamePadded = ProductName.PadRight(33); e.Value = ProductNamePadded+Price; } catch { }

look在这个问题的形象 \http://imgur/a/1DhiV 我尝试过: 0 下来投票 最爱 i我正在制作一个pos软件,现在我的客户要求的是当他们在列表框中添加2个项目2次,所以它只显示一次但这个项目的数量增加我正在研究这个但我不知道如何处理数量。

look at this image of issue \imgur/a/1DhiV What I have tried: 0 down vote favorite i am making a pos software and now my clients request is when they add 1 items 2 times in listbox so it's just show one time but quantity of this item increase i am working on this but i dont know how to work on quantity.

Button b = (Button)sender; tblProduct tp = (tblProduct)b.Tag; string product = tp.productName; lbProductsToBuy.Text = tp.ToString(); products.Add(tp); total += (decimal)tp.productPrice; var duplicates = products.GroupBy(i => i.productName) .Where(x => x.Count() > 0) .Select(val => val.Key); foreach (var item in duplicates) { } and listbox format is try { string ProductName = ((tblProduct)e.ListItem).productName; string Price = "Rs: " + String.Format("{0:}", ((tblProduct)e.ListItem).productPrice); string ProductNamePadded = ProductName.PadRight(33); e.Value = ProductNamePadded+Price; } catch { }

推荐答案

duplicates.Select(c => { c.value = txtbox.Text; return c; }).ToList()

更多推荐

如何在实体框架中更新行

本文发布于:2023-10-24 08:22:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1523432.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:实体   框架   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!