Copyright Codenstuff.com 2017
YOU NEED TO BE LOGGED IN TO USE THIS FEATURE


Register
Credits
0
Reputation
0
Sqlite Help
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.


User avatar
Sqlite Help
Sqlite Help
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
Re: Sqlite Help
Re: Sqlite Help
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
Re: Sqlite Help
Re: Sqlite Help
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
Re: Sqlite Help
Re: Sqlite Help
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
Re: Sqlite Help
Re: Sqlite Help
: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
Re: Sqlite Help
Re: Sqlite Help
: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
Re: Sqlite Help
Re: Sqlite Help
: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 ;)




Online now

Users viewing this forum: No registered users and 1 browsing

cron