Rs.Open("SELECT DISTINCTROW Max(SostituzionePortieri.Id) AS Id FROM SostituzionePortieri;", Conn, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic) If DBNull.Value.Equals(Rs.Fields("id").Value) = False Then ' If Val(Rs.Fields("id").Value) > 0 Then ContatoreRs.Fields("SostituzionePortieri").Value = Rs.Fields("id").Value Else ContatoreRs.Fields("SostituzionePortieri").Value = 0 End If |