'label 'questo può essere nullo
lblTimeTables.Text = AppFuncions.GetNotShiftTimeTables(Fields.TimeTables)
B4X:
Sub GetNotShiftTimeTables(strTimeTablesId As String) As String
Dim ReturnValue As StringBuilder
Dim TimeTables As ResultSet
ReturnValue.Initialize
If strTimeTablesId = "" Or strTimeTablesId = Null Then
ReturnValue.Append("")
Else
TimeTables = DBConnection.SQLConn.ExecQuery("SELECT * FROM SheetsTimeTables WHERE TimeTableId IN (" & strTimeTablesId & ") ORDER BY StartTime ASC")
For TimeTableId = 0 To (TimeTables.RowCount-1)
TimeTables.Position = TimeTableId
If TimeTableId > 0 Then
ReturnValue.Append(CRLF)
End If
ReturnValue.Append(TimeTables.GetString2(2))
For i = 1 To (3-TimeTables.GetString2(2).Length)
ReturnValue.Append(" ")
ReturnValue.Append(" ")
Next
ReturnValue.Append(" ")
ReturnValue.Append("T")
ReturnValue.Append(TimeTables.GetString2(3))
For i = 1 To (3-TimeTables.GetString2(3).Length)
ReturnValue.Append(" ")
ReturnValue.Append(" ")
Next
ReturnValue.Append(TimeTables.GetString2(4))
ReturnValue.Append(" ")
ReturnValue.Append(TimeTables.GetString2(5))
ReturnValue.Append("-")
ReturnValue.Append(TimeTables.GetString2(6))
ReturnValue.Append(" ")
ReturnValue.Append(TimeTables.GetString2(7))
Next
TimeTables.Close
End If
Return ReturnValue.ToString
End Sub
Risolto ho raggirato il problema se il record è null non chiamo la sub funzione e scrivo una stringa vuota nella label.
Per provarlo dovrei pubblicare l'intero progetto con db compreso.
Grazie per il tempo concesso, passo ad altro codice per altre funzioni.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.