日期:2014-05-18 浏览次数:21201 次
private void UpdateMPointsInStations() { foreach (BaseItem item in itemPanel3.Items) { ButtonItem btn = item as ButtonItem; int MPID = Convert.ToInt32(btn.Tag); Dictionary<string, string> data = new Dictionary<string, string>(); data.Add("StatID", "null"); db.Update("MPoints", data, string.Format("MPID = {0}", MPID)); } }
private void Initialize() { //初始化传感器名字的列表 InitSenList(SenList); //显示在当前工作站下,已选择的工作站 showSelectedPointsInLeftPanel(itemPanel4); //初始化剩余未被部署的测点于itemPanel中 InitRestUnSelectedMPointsInRightPanel(itemPanel3); //初始化剩余未被分配的传感器于itemPanel中 InitRestUnSelectedSensorInRightPanel(itemPanel5); //初始化表格信息 InitDataGridViewForMap(dataGridViewX1); //每次刷新时先清空itemPanel6 InitItemPanel6(itemPanel6); }
Dictionary<string, string> data = new Dictionary<string, string>(); data.Add("StatID", "null");
------解决方案--------------------
因为不知道 你的类是什么类型,ButtonItem btn = item as ButtonItem;这个是否有必要呢
------解决方案--------------------
private void UpdateMPointsInStations()
{
Dictionary<string, string> data = new Dictionary<string, string>();
data.Add("StatID", "null");
foreach (BaseItem item in itemPanel3.Items)
{
ButtonItem btn = item as ButtonItem;
int MPID = Convert.ToInt32(btn.Tag);
db.Update("MPoints", data, string.Format("MPID = {0}", MPID));
}
}