This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Database Connector Synchproject how to handle SQL apostrophe

Hello all,

we all know the issue with  handling String values that includes an Single apostrophe ( ' ).

This issue can be easily solved with escaping the apostrophe (i.e. double-up the single quote character) in your SQL statement.

My issue at that point is that I need to replace the value with an single apostrophe at 2 places, which makes no sense for me.

First, I need to replace it in the database synch project code for inserts and updates and secondly I need to replace it in addition in each attribute mapping for String values within a virtual property.

If one replace is not available, the synch is running into an error.

Is this how it should work, or do I miss something here?

Thanks, Fatih

Parents
  • Hello Markus,

    the screenshots might be confusing. There are two screenshots. The first screen is from the mapping and the second is in the ADO.NET Commit script.

    As you said, I am escaping my single quotes in my Commit script and the connector have no problems in reading values with single-quotes. Despite my escaping, I receive following error message in the Synch Log:

    I tried to pass following value: "Test'String" 

      

    I am wondering at that point, why I receive this error message and where my escaping is gone. In a follow up, I tried an additional escaping for this value in the mapping and than it works.

    Somehow, my escaping in the ADO.NET Commit script doesn't work.

    Any ideas?

    Thanks, Fatih

Reply
  • Hello Markus,

    the screenshots might be confusing. There are two screenshots. The first screen is from the mapping and the second is in the ADO.NET Commit script.

    As you said, I am escaping my single quotes in my Commit script and the connector have no problems in reading values with single-quotes. Despite my escaping, I receive following error message in the Synch Log:

    I tried to pass following value: "Test'String" 

      

    I am wondering at that point, why I receive this error message and where my escaping is gone. In a follow up, I tried an additional escaping for this value in the mapping and than it works.

    Somehow, my escaping in the ADO.NET Commit script doesn't work.

    Any ideas?

    Thanks, Fatih

Children
No Data