New topic: 

Posting data from a RealSQL databse to a ListBox

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

         Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic          Author  
Message        jonckelley          Post subject: Posting data from a RealSQL 
databse to a ListBoxPosted: Fri Mar 01, 2013 6:40 pm                         
Joined: Sat Apr 28, 2007 7:19 pm
Posts: 7                Hi, Newbie question:

i have a RealSQL database with 1 table, 3 columns. I merely want to send all 
contents to a 3 column Listbox. I have been looking for a way to get at the 
COUNT value of the table so I could manually populate columns in the ListBox 
with no luck.

Is there an easier way to do this?

Thanks much,

Jon   
                             Top                Indy          Post subject: Re: 
Posting data from a RealSQL databse to a ListBoxPosted: Fri Mar 01, 2013 7:12 
pm                         
Joined: Wed Jul 09, 2008 10:46 pm
Posts: 192
Location: Minneapolis                Here is a simple example:  lb is the 
listbox, rs is a recordset (result of the DB query)

// populate the specified listbox (generic)

lb.deleteAllRows()

while not rs.eof  // loop through each record
  lb.AddRow("")
  
  for i as integer = 1 to rs.FieldCount  // loop through each field
  lb.Cell(lb.LastIndex, i-1) = rs.IdxField(i).StringValue
  next
  
  rs.moveNext()
wend

// check if listbox is sorted by a column
if lb.SortedColumn > -1 then
  lb.Sort()
end
      
_________________
http://www.miscjunk.org  
                             Top                jonckelley          Post 
subject: Re: Posting data from a RealSQL databse to a ListBoxPosted: Fri Mar 
01, 2013 8:20 pm                         
Joined: Sat Apr 28, 2007 7:19 pm
Posts: 7                Indy, thanks much this worked like a charm!   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 3 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