CodeSmith Community
Your Code. Your Way. Faster!

Find, AppendEquals and apostrophe

Latest post 04-10-2008 11:55 AM by Muszal. 2 replies.
  • 04-10-2008 8:08 AM

    • Muszal
    • Not Ranked
    • Joined on 04-10-2008
    • Posts 2
    • Points 40

    Find, AppendEquals and apostrophe

    Some Scottish and Irish surnames use an apostrophe after an M or O, for example O'Brien. It seems like SqlUtil.Encode function replacing that apostrophe with '' first and then it is replaced again when in Command. So finaly the find parameter looks like @Param0 = N'O''''Brien' instead of @Param0 = N'O''Brien' what results wrong find results.

    • Post Points: 35
  • 04-10-2008 11:48 AM In reply to

    • blake05
    • Top 25 Contributor
    • Joined on 04-03-2008
    • Wisconsin
    • Posts 317
    • Points 5,580

    Re: Find, AppendEquals and apostrophe

    Hello,

    I’ve ran into this before, what I do if I know that I could have text that has the possibility of containing a character like ‘. I escape it during any CRUD operations by doing a string replace with a specific character like ^ beforehand. I’ve found that you could try encoding it but most of the time it will just create more headaches.

    Thanks

    Blake Niemyjski

    Blake Niemyjski

    CodeSmith Tools, LLC Support Specialist

    Blog: http://windowscoding.com/blogs/blake/

    ----------------------------------------------------------------------
     Member of the .NetTiers team | Visit http://www.nettiers.com
    ----------------------------------------------------------------------

    • Post Points: 35
  • 04-10-2008 11:55 AM In reply to

    • Muszal
    • Not Ranked
    • Joined on 04-10-2008
    • Posts 2
    • Points 40

    Re: Find, AppendEquals and apostrophe

    Hi Blake,

    NetTiers it is doing that anyway - I was just saing that when using ParameterBuilder's Append or AppendEquals it uses SqlUtil.Encode that is actually duplicating what is done next.

    • Post Points: 5
Page 1 of 1 (3 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems