Quotation Marks and Formatted Text

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
acolburn
Posts: 6
Joined: Fri Jul 12, 2013 9:26 pm

Quotation Marks and Formatted Text

Post by acolburn » Thu Aug 01, 2013 6:01 pm

My ultimate question is: What code (and properties) allows users to save formatted text to a (SQLite) database?

Here are details:

I have a field where users might paste text from an office application. The field's contents are then inserted into a (SQLite) database field (of type text). Right now I create the SQL statement as just:

Code: Select all

put the label of button "ComboBoxStudent" of card "New Note" of stack "Grad Log" into aName
put the htmltext of field "FieldScratchPad" into aMemo
--the button contains a name, the field contains the text I want to post, student is the table's name
put "UPDATE student" && \
      "SET scratchpad="&quote&aMemo&quote&& \
      "WHERE name="&quote&aName&quote into tSQL
I get errors if my text (FieldScratchPad) contains quotation marks, because of how my SQL statement is written. I also get errors with most text pasted from other applications--whether I put the text, htmltext, or rtftext of field FieldScratchPad into the db.

acolburn
Posts: 6
Joined: Fri Jul 12, 2013 9:26 pm

Re: Quotation Marks and Formatted Text

Post by acolburn » Thu Aug 01, 2013 11:36 pm

I am changing my code thusly:

Code: Select all

   put the label of button "ComboBoxStudent" of card "New Note" of stack "Grad Log" into aName
   put the htmltext of field "FieldScratchPad" into aString
   replace quote with numtochar(2) in aString
   put aString into aMemo
along with companion code to replace numtochar(2) with quote when selecting text from the db and, so far, I think it's working OK.

phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Re: Quotation Marks and Formatted Text

Post by phaworth » Tue Oct 29, 2013 11:09 pm

Check out the variable substitution forms of the revDatabasexxx commands in the dictionary. You don;t need to do any special processing of the text if you use that method.
Pete

Post Reply