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.
9 posts Page 1 of 1
Contributors
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Sqlite Help
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
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4389
Joined: Tue Aug 04, 2009 1:47 am

Re: Sqlite Help
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
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Sqlite Help
Dummy1912
Hi,

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

any idea?
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4389
Joined: Tue Aug 04, 2009 1:47 am

Re: Sqlite Help
CodenStuff
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
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Sqlite Help
Dummy1912
Hi,

The db is empty :D
so no records exists yet
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4389
Joined: Tue Aug 04, 2009 1:47 am

Re: Sqlite Help
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
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Sqlite Help
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;
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Sqlite Help
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
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Sqlite Help
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 ;)
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
9 posts Page 1 of 1
Return to “Coding Help & Support”