Page 1 of 1

Sqlite Help

Posted: Mon Sep 11, 2017 6:01 pm
by Dummy1912
Hi,

i was wondering if someone could tell me how i can really detect if no records exist or just has only value 'True' in it

i use:
Code: Select all
            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
                Exit Function
            Else
                MyFunctions.IsSubmitted = False
                Return True
                Exit Function
            End If
but it always return 0 even if we have no data in the table :(
Help please

Thanks

Re: Sqlite Help

Posted: Wed Sep 13, 2017 4:33 pm
by CodenStuff
Would it not always return 0 if no records exist anyway

If no records then it would return 0

Say if you have 3 records it should return 3...etc

Re: Sqlite Help

Posted: Wed Sep 13, 2017 4:38 pm
by Dummy1912
Hi,

Yeah , but its not :( it returns 0
and i had a empty db so no records exists

any idea?

Re: Sqlite Help

Posted: Thu Sep 14, 2017 4:33 pm
by CodenStuff
Okay how many records do you have in that particular database?

Re: Sqlite Help

Posted: Thu Sep 14, 2017 4:40 pm
by Dummy1912
Hi,

The db is empty :D
so no records exists yet

Re: Sqlite Help

Posted: Fri Sep 15, 2017 4:04 pm
by CodenStuff
Dummy1912 wrote:
Hi,

The db is empty :D
so no records exists yet
lol okay. So if no the database has no records the count will return 0 because there are no records ...ie: nothing in the database = 0 records to count

Or am I missing something :duh; lol

Re: Sqlite Help

Posted: Fri Sep 15, 2017 4:57 pm
by Dummy1912
:teehe; maybe me

is there a extra way so if no records exist we can get an other message?

instead of 0 maybe false?
so we can use that option when we are loading the db and then we can leave that empty instead of submitted ;)
if you can follow :lover;

Re: Sqlite Help

Posted: Sat Sep 16, 2017 10:55 am
by Dummy1912
:darnit;

making me so ....
search on the net for long time
and still nothing about that part we are looking for
just always with 0 even if empty or not.. always that stupid 0
why can't be there a easier solution hahaha

Re: Sqlite Help

Posted: Sun Sep 17, 2017 10:04 am
by Dummy1912
:D
solved,

i just added a new connection to see if any records exist before we go to the submitted part
and seems that did the trick ;)