• Top Members
    Reps
    Posts
  • 834 Replies
    2585 Replies
  • 713 Replies
    2021 Replies
  • 331 Replies
    1928 Replies
The site is still being updated (as of 14th Jan 2018 6PM GMT) but can be used in the meantime.

Sqlite Help

Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Locked
User avatar
Dummy1912
VIP - Donator
Posts: 1947

Sqlite Help

Mon Sep 11, 2017 7:01 pm

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

User avatar
CodenStuff
Site Admin
Posts: 4348

Re: Sqlite Help

Wed Sep 13, 2017 5:33 pm

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
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.

User avatar
Dummy1912
VIP - Donator
Posts: 1947

Re: Sqlite Help

Wed Sep 13, 2017 5:38 pm

Hi,

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

any idea?

User avatar
CodenStuff
Site Admin
Posts: 4348

Re: Sqlite Help

Thu Sep 14, 2017 5:33 pm

Okay how many records do you have in that particular database?
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.


User avatar
CodenStuff
Site Admin
Posts: 4348

Re: Sqlite Help

Fri Sep 15, 2017 5:04 pm

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
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.

User avatar
Dummy1912
VIP - Donator
Posts: 1947

Re: Sqlite Help

Fri Sep 15, 2017 5:57 pm

: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;

User avatar
Dummy1912
VIP - Donator
Posts: 1947

Re: Sqlite Help

Sat Sep 16, 2017 11:55 am

: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

User avatar
Dummy1912
VIP - Donator
Posts: 1947

Re: Sqlite Help

Sun Sep 17, 2017 11:04 am

: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 ;)

Locked

Return to “Coding Help & Support”