值不变时保持恒定值.值更改时更新数据表 [英] Maintain Constant Value when value not changed& update the datatable when value changed

查看:80
本文介绍了值不变时保持恒定值.值更改时更新数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了OPC服务器从OPC服务器读取标签的应用程序,存储到MYSQL表中.
在这个过程中,我将所有更改值都放入了数组中.
然后这个值存储到MYSQL表中.但是问题是这个OPC服务器仅返回更改参数(例如,如果温度变化则为室温,则返回值,否则不返回任何值).所以我想观察标签的每秒值(温度),但只有在更改值时我才能获取数据.
但我想要这样

I developed the application for OPC server Reading Tags from the OPC server & stored into the MYSQL table.
In this I get the all changes values into the array.
then this values are stored into the MYSQL table.But the problem is this OPC server returns only change parameter (e.g room temperature if temperature change then it returns the value otherwise nothing).So i want to watch the per second value of the tags(temperature) but i will get the data only when the value get changed.
but I want like this

2011-07-01 01:00:00  1 
2011-07-01 01:00:01  2//changed
2011-07-01 01:00:02  2
2011-07-01 01:00:03  2
2011-07-01 01:00:04  3//changed



所以我将用来存储常数值的&新的更新将存储到一个日志中.在我的应用程序中,我将使用数据表,但是当我更新现有值时,它会抛出异常



so what i will be used to stored the constant value also & new updated will be stored into the one log In my application i will be used the datatable but when i will be updated the existing value it throws exception as

Data Table internal index is corrupted: 5


这些都是使用线程完成的

任何解决方案
在此先感谢...


these all things are done using threading

Any solution
thanks in advance...

推荐答案

那是因为值5超出了数据表中行集合的范围.该大学是从0开始的,因此您最后一个可用的索引是4.除了看不到您的代码,我只能推荐您从当前使用的索引值中减去1而已.
That''s because the value 5 is outside the range of the collection of rows in the datatable. The colleciton is 0-based, so your last avaiable index is 4. Without seeing your code, I can''t recommend anything more than merely subtracting 1 from the current index value you''re using.


这篇关于值不变时保持恒定值.值更改时更新数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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