从Datagridview到数据库的数据传输(SQL表). [英] Data Transfer From Datagridview to database (Sql Table).

查看:92
本文介绍了从Datagridview到数据库的数据传输(SQL表).的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在datagridview中,我有以下Coloumns:
1.产品名称
2.评分
3.数量
4. Amt
5.上一页Bal
6.总Amt
7.支付金额
8. Bal Amt
我已将产品表链接到我的表单.从中我得到前两个列的产品名称和费率,第三个列的用户将输入数量,第四个列的值将乘以费率*数量.第五列值将来自另一个表.第六列值将是第四列和第五列的加法.在第七列中,用户条目(客户支付的金额)将在第八列中减去第六-第七列,即(总金额-已支付Amt).

如果第一个栏目中列出了10种产品,则客户不必购买全部10种产品.如果客户购买了4种产品,则客户购买该行的产品的全部信息应保存在数据库中,即产品名称,价格,数量,金额等.

我该怎么办?


在此先感谢!!!!

In a datagridview I have following Coloumns:
1. Product Name
2. Rate
3. Qty
4. Amt
5. Prev Bal
6. Total Amt
7. Amt Paid
8. Bal Amt
I have linked Product table to my form. from that I am getting Product Name and rate in first two coloumn and third col user will enter qty in fourth col value will come by multiplying Rate * Qty. Fifth Col value will come from another table.Sixth Col Value will be Addition of Fourth and Fifth Col.in Seventh Col the user entry (Customer paid amt) and in eight col vale will be Subtraction of Sixth - Seventh Col i.e. (Total Amt - Amt Paid).

If there are suppose 10 products listed in first Col. and this is not necessary that customer will buy all 10 products. if customer buys 4 products then the products which customer buys that row entire information should be saved in database i.e. product name, rate, qty, amt, etc.

How Do I do it ?


Thanks in Advance !!!!

推荐答案

您可以在DataGridview中放置一个复选框,同时单击购买"按钮,您可以简单地遍历网格,如果检查选中框,然后将产品详细信息添加到ProductInfo列表.然后将此产品信息传递给更新方法.
You can place a check box in DataGridview while clicking on "Buy" button you can simply loop through the grid and if the check box is cheked then add the product details to a ProductInfo List. then pass this product info to the update method.


这篇关于从Datagridview到数据库的数据传输(SQL表).的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆