如果在datalist的itemcommand中传递相同的commandargument,则将datable列值加倍 [英] Double the datable column values based on if same commandargument is passed in itemcommand of datalist

查看:90
本文介绍了如果在datalist的itemcommand中传递相同的commandargument,则将datable列值加倍的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据列表,它在项目模板中有按钮...

和iam使用itemid的命令参数并将其填充到一个数据表中,其中inturn绑定到gridview。当我点击按钮(通过命令参数)时,我正在填充数据表。但如果我点击相同的行,如果传递相同的命令参数,我想更新数据表特定列值而不是填充数据表中的重复行



我尝试了什么:



i一直在尝试使用数据表更新选项的替代方法但不工作。等待有利的回复

i am having a datalist which is having button inside an item template ...
and iam working with command argument for itemid..and populate it in a datatable which inturn is bind to gridview. i am populating datatable when i click on button (through command argument). but if i click on same row that is if same command argument is passed i want to update the datatable specific column values instead of populating the duplicate row in datatable

What I have tried:

i have been trying with alternate ways with the datatable update options but not working.waiting for a favourable reply

推荐答案

假设您有本地数据库实例设置或使用本地数据库来完成工作。



编写SQL命令对'Total'表进行更新,然后重新绑定到前端控件以显示更新的值。

例如

表:'总计'

Assuming you have a local database instance setup or use local db to get the job done.

Write a SQL command to do an update to a 'Total' table then re-bind to front end controls to show updated value.
e.g.
Table: 'Total'
___________________
|ItemId|Qty|OrderId|
|     1|  2|      1|
|______|___|_______|





SQL:

(我假设你正在使用MS SQL express或类似的东西)

UPDATE TOTAL SET Qty = @Qty WHERE ItemId = @ItemId AND OrderId = @OrderId。



传入一些上面带有'@'前缀名称的SQL参数,并将它们的值设置为新的Qty和item / order id。



SQL:
(I am assuming you are using MS SQL express or something like that)
UPDATE TOTAL SET Qty = @Qty WHERE ItemId = @ItemId AND OrderId = @OrderId.

Pass in some SQL parameters with the '@' prefixed names above and set their values to the new Qty and item/order id.


这篇关于如果在datalist的itemcommand中传递相同的commandargument,则将datable列值加倍的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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