msgbox(e.DataCol.name) If e.DataCol.name = "借出数量" Then Dim dr As DataRow Dim t As Integer dr = DataTables("现有库存").Find("[学科编号] = '" & e.DataRow("学科编号") & "'") If dr IsNot Nothing Then t = dr("现有_数量") msgbox(t) If e.NewValue > t Then MessageBox.Show("借出数量超过库存","提示") e.Cancel = True End If End If End If