Filtering for single quotes

I have a form with several large text fields for users to input instructions.  If they use a single quote (apostrophe) I get an Oracle error.   How can I allow the users to user the single quotes in these fields?  It's impossible to tell them not to.

 

Thanks!  (and I'm not a programmer so please be gentle).

Tagged:

Comments

  • Use SelectSql() and paramaters for all database interaction. It is the only way that is simple and safe.

     

    Step 2: Ask Metatsorm to add parameters to all the database functions...

  • The error comes when they try to save the form.   The text field is tied to a local variable.   Can you clarify the parameter I should be setting?  Thanks!

  • You are not updating a record directly? If these are Process Variables, that sounds like a massive bug. I shall try on our Oracle installation today to confirm.

  • On field exit, I've tried adding

     

    Replace(Local.memAction, "'", "''", 0)

     

    But still get the same error.  Anyone have a working solution?  Thanks!

  • We have tried this on several of our Oracle installations, and it works perfectly. Can you confirm that this is a standard variable, and that you are not executing any SQL?

     

    Could you also confirm the version?

  • The fix was to NOT use the "InsertRows" from the toolbox with a simple Insert statement but to use the "Code Activity" and enter something like:

    {

    Mstm.SelectSql(new MetastormDefault(),@INSERT INTO YOUR_TABLE

    (Column1,Column2)

    VALUES (@p1, @p2)",

          new QueryParameter("@p1",Local.Variable1),

          new QueryParameter("@p2",Local.Variable2)

          );

    }

     

    Now the user can use as many apostrophes as they want.