Untitled

mail@pastecode.io avatar
unknown
vbscript
a month ago
1.7 kB
2
Indexable
Never
  ElseIf fld = "AidGivenOrReceived" Then
      Try
          Dim strx As String
          Dim Command As SqlCommand, connection As SqlConnection, dataReader As SqlDataReader
          strx = "Select min(ApparatusINC.Arrival) As Arrival,min(ApparatusINC.DispatchDC) As DispatchDC,min(ApparatusINC.Enrout) As Enroute, max(ApparatusINC.Cleared) As Cleared "
          strx = strx & " from ApparatusINC  where Incident=" & Nz(incidentid, 0) & " And Exposure=" & Nz(ExposureNum, 0)
          If vall <> "1" And vall <> "2" Then
              strx = strx & " and ApparatusINC.appmone>0"
          End If
          connection = New SqlConnection(_contextinci.Database.Connection.ConnectionString)
          Command = New SqlCommand(strx, connection)
          connection.Open()
          dataReader = Command.ExecuteReader()
          If dataReader.HasRows Then
              While dataReader.Read() ' And mone < 60
                  If Not IsNothing(dataReader("Arrival")) Then
                      rw.Arrival = Nz(dataReader("Arrival"), 0)
                  End If
                  If Not IsNothing(dataReader("DispatchDC")) Then
                      rw.AlarmTime = Nz(dataReader("DispatchDC"), 0)
                  End If
                  If Not IsNothing(dataReader("Cleared")) Then
                      rw.LastUnitCleared = Nz(dataReader("Cleared"), 0)
                  End If
                  If Not IsNothing(dataReader("Enroute")) Then
                      rw.Enroute = Nz(dataReader("Enroute"), 0)
                  End If
              End While
          End If
          dataReader.Close()
          connection.Close()
      Catch ex As Exception

      End Try
Leave a Comment