Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed May 23, 2018 9:31 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: A Question about RecordSet
PostPosted: Mon Apr 08, 2013 1:10 pm 
Offline
User avatar

Joined: Wed Jul 07, 2010 2:55 pm
Posts: 720
Location: University Of Calgary, Faculty Of Medicine
I do an SQL query and my record set returned is not NULL but there are no records in the record set.
I can access the record set but there is nothing in it. :roll:

myRS = dc.SQLSelect(sql)
if dc.Error or myRS = nil then
fileLocs.Append("Unknown")
else
fl = myRS.IdxField(1).StringValue
if fl = "" then
fileLocs.Append("Unknow") // This is where my code reaches... ????
else
fileLocs.Append (fl)
end if
end if

Is there a way to know that 0 records were returned?

_________________
If at first you don't succeed... Try REALBasic and if that doesn't work try Xojo.


Top
 Profile  
Reply with quote  
 Post subject: Re: A Question about RecordSet
PostPosted: Mon Apr 08, 2013 1:27 pm 
Offline

Joined: Wed May 20, 2009 4:43 pm
Posts: 958
BrianOBrien wrote:
I do an SQL query and my record set returned is not NULL but there are no records in the record set.
I can access the record set but there is nothing in it. :roll:

myRS = dc.SQLSelect(sql)
if dc.Error or myRS = nil then
fileLocs.Append("Unknown")
else
fl = myRS.IdxField(1).StringValue
if fl = "" then
fileLocs.Append("Unknow") // This is where my code reaches... ????
else
fileLocs.Append (fl)
end if
end if

Is there a way to know that 0 records were returned?




myRS = dc.SQLSelect(sql)
if dc.Error or myRS = nil then
fileLocs.Append("Unknown")
else

If (MyRS.BOF AND MyRS.EOF) then
// No records
else

fl = myRS.IdxField(1).StringValue
if fl = "" then
fileLocs.Append("Unknow") // This is where my code reaches... ????
else
fileLocs.Append (fl)
end if
end if
end if

_________________
RB 2009r4 Windows XP


Top
 Profile  
Reply with quote  
 Post subject: Re: A Question about RecordSet
PostPosted: Mon Apr 08, 2013 2:06 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
myRs = nil means there was an sql error.
myRs <> nil and myRs.EOF means there was no error, but there were no matching records.


Top
 Profile  
Reply with quote  
 Post subject: Re: A Question about RecordSet
PostPosted: Tue Apr 16, 2013 11:58 am 
Offline
User avatar

Joined: Wed Feb 01, 2012 3:06 pm
Posts: 68
You can also look at myRs.RecordCount

_________________
Ron Bower
Ellicott City, MD


Top
 Profile  
Reply with quote  
 Post subject: Re: A Question about RecordSet
PostPosted: Tue Apr 16, 2013 12:06 pm 
Offline

Joined: Wed May 20, 2009 4:43 pm
Posts: 958
RonBower wrote:
You can also look at myRs.RecordCount

That is not supported for all database engines. Databases which do not support this will return -1.

_________________
RB 2009r4 Windows XP


Top
 Profile  
Reply with quote  
 Post subject: Re: A Question about RecordSet
PostPosted: Tue Apr 16, 2013 1:55 pm 
Offline
User avatar

Joined: Wed Jul 07, 2010 2:55 pm
Posts: 720
Location: University Of Calgary, Faculty Of Medicine
markwalsh wrote:
RonBower wrote:
You can also look at myRs.RecordCount

That is not supported for all database engines. Databases which do not support this will return -1.
Interesting.. I must have passed over this method in the documentation.. and rather happy i did too...

_________________
If at first you don't succeed... Try REALBasic and if that doesn't work try Xojo.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group