New topic: 

[Solution found] SQLSelect not returning anything...

<http://forums.realsoftware.com/viewtopic.php?t=44798>

         Page 1 of 1
   [ 10 posts ]                 Previous topic | Next topic          Author  
Message        kript0x          Post subject: [Solution found] SQLSelect not 
returning anything...Posted: Sat Jul 21, 2012 1:04 pm                         
Joined: Fri Jul 20, 2012 2:09 pm
Posts: 10                sqlColumnSettings = "SELECT Webhosting, VPS, Cloud, 
Colocaties, DedicatedServer, RDP, Exchange, Domein from tblBeheer"
dim settings as RecordSet = dccomsitepro.SQLSelect(sqlColumnSettings)
msgbox(settings.Field("Webhosting"))


Webhosting is a BIT on 1
msgbox returns nothing...

weird thing is that the qry works in SequelPro and other querys in the same 
method work.     

    Last edited by kript0x on Sat Jul 21, 2012 4:13 pm, edited 2 times in 
total.   
                             Top                kermit          Post subject: 
Re: SQLSelect not returning anything...Posted: Sat Jul 21, 2012 1:34 pm         
                
Joined: Mon May 30, 2011 12:56 am
Posts: 483                check for errors on the database.
Check if settings is nil

and is  Domain spelled as Domein  in your table?   
                             Top                Jason_Adams          Post 
subject: Re: SQLSelect not returning anything...Posted: Sat Jul 21, 2012 1:35 
pm                                 
Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1631
Location: Michigan, USA                Check the database for any errors 
whenever you perform a query or execution. If you were and it's not helping, 
please include that in your code so we know you're doing it and where.

Also, pause in the debugger and inspect the RecordSet to see if it has any 
contents at all.

Hope this helps.     
_________________
Windows 7 Ultimate x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2011r4

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult 
and not tried." - G.K. Chesterton  
                             Top                kript0x          Post subject: 
Re: SQLSelect not returning anything...Posted: Sat Jul 21, 2012 1:48 pm         
                
Joined: Fri Jul 20, 2012 2:09 pm
Posts: 10                Thanks for the replies guys, I really appreciate it.
How do I check for errors on the database? The query runs fine in SequelPro

The settings recordset does have a correct FielCount but (when paused on line 
3) it gives EOF & BOF = false
When I look at the values, I don't know what I see...



Also settings (the recordset) is not NIL.   
                             Top                timhare          Post subject: 
Re: SQLSelect not returning anything...Posted: Sat Jul 21, 2012 2:49 pm         
                
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 11537
Location: Portland, OR  USA                Shouldn't that be

msgbox(settings.Field("Webhosting").StringValue)

settings.Field("Webhosting") is an object of type DatabaseField.  I don't know 
what happens when you try to autoconvert to a string.

You should also test for settings.Field("Webhosting") not nil before you access 
it.   
                             Top                kript0x          Post subject: 
Re: SQLSelect not returning anything...Posted: Sat Jul 21, 2012 2:54 pm         
                
Joined: Fri Jul 20, 2012 2:09 pm
Posts: 10                timhare wrote:Shouldn't that be

msgbox(settings.Field("Webhosting").StringValue)

settings.Field("Webhosting") is an object of type DatabaseField.  I don't know 
what happens when you try to autoconvert to a string.

You should also test for settings.Field("Webhosting") not nil before you access 
it.

Using StringValue() or BooleanValue() both didn't work, 
settings.Field("Webhosting") is not NIL
I tried everything I can think off.   
                             Top                timhare          Post subject: 
Re: SQLSelect not returning anything...Posted: Sat Jul 21, 2012 2:57 pm         
                
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 11537
Location: Portland, OR  USA                Is it possible that the first record 
returned is blank?  Try running through all the records in a loop.
while not settings.EOF
  msgbox settings.Field("Webhosting").StringValue
  settings.MoveNext
wend
   
                             Top                kript0x          Post subject: 
Re: SQLSelect not returning anything...Posted: Sat Jul 21, 2012 3:10 pm         
                
Joined: Fri Jul 20, 2012 2:09 pm
Posts: 10                timhare wrote:Is it possible that the first record 
returned is blank?  Try running through all the records in a loop.
while not settings.EOF
  msgbox settings.Field("Webhosting").StringValue
  settings.MoveNext
wend

Returns 1 blank msgbox.
The table only has 1 row btw.   
                             Top                timhare          Post subject: 
Re: SQLSelect not returning anything...Posted: Sat Jul 21, 2012 3:31 pm         
                
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 11537
Location: Portland, OR  USA                Is there data in the record?  (Can 
you see the values from another program?)
Is it ASCII (non-UTF8) data?
Are you connected to the correct database?  (Happens a lot.  Forehead slapping.)
What does this mean:
Quote:Webhosting is a BIT on 1
What database?  What is the column type?  Maybe this isn't a string you're 
looking for?  (Msgbox made be think it was.)   
                             Top                kript0x          Post subject: 
Re: SQLSelect not returning anything...Posted: Sat Jul 21, 2012 4:06 pm         
                
Joined: Fri Jul 20, 2012 2:09 pm
Posts: 10                timhare wrote:Is there data in the record?  (Can you 
see the values from another program?)
Is it ASCII (non-UTF8) data?
Are you connected to the correct database?  (Happens a lot.  Forehead slapping.)
What does this mean:
Quote:Webhosting is a BIT on 1
What database?  What is the column type?  Maybe this isn't a string you're 
looking for?  (Msgbox made be think it was.)

Webhosting, the column in the table is a bit (I think its called bool or 
boolean in other sqls idk)
I initially tried BooleanValue() but that didn't give any result either.
I have no problem using the query is SequelPro (its an sql tool for mac).

engine is MyISAM, MySQL. Reading other tables from the same db, in the same 
project work fine.

Guess what: 
msgbox(str(settings.Field("Webhosting").BooleanValue()))
 
prints "False" , While debugging Webhosting in Variables prints "0"

In the database it is on 1 ;(


HOORAY
Because you made that remark about the BIT thingy (as if you never heard about 
it) I tried TINYINT and it works like a charm now 
Seems rb doesn't support bit.   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 10 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to