在子表新建行,选择1行判断后,
2个 MessageBox 出来的数据显示正常,都是1,
而父表项目数0 数据库里还是0,要多选择几个判读或者 取消后 重新判断才能触发统计,这个是怎么回事呢
If e.DataCol.Name = "是否符合" Then
If e.NewValue = True
DataTables("项目").Save()
Dim dr As DataRow = e.DataRow
Dim cmd,cmd1 As New SQLCommand
cmd.C
cmd1.C
cmd.commandtext = "select count ([_Identify]) from {项目} where [编号] = '" & dr("编号") & "' and [是否符合] = 1 "
Dim xms As Integer = cmd.ExecuteScalar() '
MessageBox.show(xms)
cmd1.commandtext = "update {检验样品} set [进度] = " & xms & " where [编号] = '" & dr("编号") & "'"
Dim Count1 As Integer = cmd1.ExecuteNonQuery()
Messagebox.Show( "总共" & Count1 & "行!")
end if
end if