带有转发器和修改值的mysql [英] mysql with repeater and modified values
问题描述
我将mysql中的值放入转发器中
并为每一行计算一些值,然后根据id在转发器中仅显示该值。 ..
for exp。
in mysql我有价值
名字姓名价格
maulik shah 258
perva rasool 123
分享taval 147
现在,我想为maulik增加25个价格,为perva增加85个和aspx.cs代码中的共享者的价格相同,然后在转发器中设置,,,
或在转发器中设置第一个数据源,然后进行更改..
或你建议
i hope您了解..
I place values from mysql into repeater
and have some values to be calculated for each row , and then display only that value in repeater according to the id ...
for exp.
in mysql i have values
name surname price
maulik shah 258
perva rasool 123
sharer taval 147
Now , i want to add 25 to price for maulik, add 85 to perva ,and same price for sharer in aspx.cs code behind and then set in repeater ,,,
or set first datasource in repeater and then make changes..
or u suggest
i hope you understood..
推荐答案
您可以使用ado.net功能为数据集设置值。
从sql获取数据时
使用datatable对象并根据需要更改值如下所示
you can set values to the dataset using ado.net features.
when you get data from sql
use datatable object and change the values as per you need like below
for(int i = 0;i<dt.roww.count;i++)
{
if(discount != 0)
{
double newvlaue = oldvalue + (oldvalue * discount)/100;
datatable.rows[0]["price"] = newvlaue
}
else
{
keep price as it is
}
datatable.acectpchanges();
repeater.datasource = datatable;
repeater.databind();
}
这篇关于带有转发器和修改值的mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!