New topic: 

single quotes in string fields to be inserted into sql table

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

         Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic          Author  
Message        plunkettphoto          Post subject: single quotes in string 
fields to be inserted into sql tablePosted: Fri Jun 11, 2010 9:46 am            
             
Joined: Fri Oct 10, 2008 7:14 pm
Posts: 29                Code:  sFileName = tfFileName.text + "-WJP-" + 
str(iGUID)
  sql1 = "INSERT INTO SubPrep (GUID, FileName, ShortCaption, Species, Location, 
Year, KACImage, KACSubmission) VALUES ("
  sql2 = str(iGUID) + ", '" + sFileName + "', "
  sql3 =  "'" + tfSubject.text + "', "
  sql4 = "'" + tfSpecies.Text + "', "
  sql5 = "'" + tfLocation.Text + "', "
  sql6 = "'" + tfYear.Text + "', " + "'true'" + ", " + sSub + ")"
  sql = sql1 + sql2 + sql3 + sql4 + sql5 + sql6
  dbWPP.SQLExecute(sql)

My problem is that tfSubject.text and tfLocation.text may or may not contain a 
single quote mark.  The situation that raised the issue was "Gambel's Quail" in 
tfSubject.text.  How do you handle a single quote if you don't know when it 
will be there?

thanks
bill   
                             Top            Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]      
-- 
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