Page 1 of 1

Looking if DB Records Don't contains any?

Posted: Thu Aug 24, 2017 4:56 pm
by Dummy1912
Hello,

Can someone give me an example for
when looking from a DB Table Ledger
and see if no records from Ledger contains a value 'False'
i just need to check from Ledger table 1 value only not the other values that contains 'True or False'

i use Sqlite ;)

Thanks

Re: Looking if DB Records Don't contains any?

Posted: Thu Aug 24, 2017 7:53 pm
by Dummy1912
Jikes that was a good thinking lol

i did this and works :nersmile

what coffee do sometimes
Code: Select all
                        If SearchSubmitted("False", .mMonthID, .mYearID) Then
                            .Notes = ""
                        Else
                            .Notes = "Submitted"
                        End If


    Public Function SearchSubmitted(ByVal Value As String, ByVal monthid As Integer, ByVal yearid As Integer) As Boolean
        'WHERE SALARY LIKE '200%'
        Try
            Dim whereClause As String = "monthid ='" & monthid & "' AND yearid ='" & yearid & "' AND status LIKE '" & Value & "%'"
            Dim count As Integer = Convert.ToInt32(DataBase.ExecuteScalar("SELECT count(*) FROM transactions WHERE " & whereClause & " ;"))

            If count = 0 Then
                MyFunctions.IsSubmitted = True
                Return False
            Else
                MyFunctions.IsSubmitted = False
                Return True
                Exit Function
            End If
            Return True
        Catch ex As Exception
            MyFunctions.IsSubmitted = False
            Return False
            Exit Function
        End Try
    End Function


Re: Looking if DB Records Don't contains any?

Posted: Fri Aug 25, 2017 3:15 pm
by CodenStuff
Sorry I wasn't around to help answer your question.

However, I do like it when you find the solution yourself. It shows that you're learning new things on your own and your knowledge of coding is getting better and better. Well done.

The code-force is with you :)