New topic: 

Mystery space in listbox cell

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

         Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic          Author  
Message        Roll          Post subject: Mystery space in listbox cellPosted: 
Fri Mar 01, 2013 7:57 pm                         
Joined: Thu Jan 24, 2013 8:08 pm
Posts: 9                I can't get this to stop happening. When I update the 
db from the editable listbox cell I always get a leading space on the left of 
the updated db entry. How can I get rid of this? I'm using this code. Thanks 
for any suggestions.
dim dbColumn, dbColumns (-1) as string
dbColumns = array ( "ID", "Species", "Date", "Number", "Time", "Temp", 
"Observer" )
dbColumn = dbColumns ( column )

dim i As Integer
i=val(me.Cell(me.ListIndex, 0))

Dim s As String
s = trim(me.ActiveCell.Text)

dim sql as string
// Update the record

sql = "UPDATE Sightings SET "+dbColumn+" = ' "+s+ " ' WHERE ID = ' " +str( i 
)+" ' "
db.sqlExecute sql
db.commit
   
                             Top                Indy          Post subject: Re: 
Mystery space in listbox cellPosted: Fri Mar 01, 2013 8:15 pm                   
      
Joined: Wed Jul 09, 2008 10:46 pm
Posts: 192
Location: Minneapolis                You have spaces in your update 
string...change it to:

sql = "UPDATE Sightings SET "+dbColumn+" = '"+s+ "' WHERE ID = ' " +str( i )+" 
' "

I took the spaces out that were between the single and double quotes on each 
side of the 's' variable.      
_________________
http://www.miscjunk.org  
                             Top                Roll          Post subject: Re: 
Mystery space in listbox cellPosted: Fri Mar 01, 2013 8:40 pm                   
      
Joined: Thu Jan 24, 2013 8:08 pm
Posts: 9                Oh, now I see it. Thanks for the extra eyes!   
                             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