Select Case e.DataCol.Name
Case "日发电量","日期","名称"
If e.DataRow.IsNull("名称") = False Then
Dim dr As DataRow =DataTables("电站").Find("名称='" & e.DataRow("名称") & "'")
If dr Is Nothing Then
dr = DataTables("电站").AddNew()
dr("名称") = e.DataRow("名称")
End If
DataTables("电站").DataCols("名称").RaiseDataColChanged(dr)
If e.DataRow.IsNull("日期") = False
Dim d As Date = e.DataRow("日期")
d = new Date(d.Year,d.Month,1)
dr = DataTables("电站月读数").Find("名称='" & e.DataRow("名称") & "' and 月期=#" & d & "#")
If dr Is Nothing Then
dr = DataTables("电站月读数").AddNew()
dr("名称") = e.DataRow("名称")
dr("月期") = d
End If
DataTables("电站月读数").DataCols("名称").RaiseDataColChanged(dr)
End If
End If
If e.DataCol.Name = "名称" AndAlso e.OldValue > "" Then
Dim dr As DataRow =DataTables("电站").Find("名称='" & e.OldValue & "'")
If dr IsNot Nothing Then
DataTables("电站").DataCols("名称").RaiseDataColChanged(dr)
End If
Dim d As Date = e.DataRow("日期")
d = new Date(d.Year,d.Month,1)
dr = DataTables("电站月读数").Find("名称='" & e.OldValue & "' and 月期=#" & d & "#")
If dr IsNot Nothing Then
DataTables("电站月读数").DataCols("名称").RaiseDataColChanged(dr)
End If
End If
End Select