how to insert '\' character

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thesti
    New Member
    • Nov 2007
    • 144

    #1

    how to insert '\' character

    hello,

    i have a field in my table to store a file path. for example it could be 'C:\My Documents\myFol der\myFile'.

    when i retrieve the record from mySQL. the value of the file path become 'C:My DocumentsmyFold ermyFile'. without the '\' backslash character.

    the question is how to store backslash character in mysql.
    Thank you
  • anijos
    New Member
    • Nov 2008
    • 52

    #2
    Try double backlashes or use no_backlash_esc apes.

    Code:
    root@test>set sql_mode='NO_BACKSLASH_ESCAPES';

    Comment

    • mwasif
      Recognized Expert Contributor
      • Jul 2006
      • 802

      #3
      How you are saving your data? If you are using some programming language like PHP then you should use addslashes().

      Comment

      • thesti
        New Member
        • Nov 2007
        • 144

        #4
        Hi,

        thanks for the reply. well, i use VB .NET as the programming language.

        Comment

        • mwasif
          Recognized Expert Contributor
          • Jul 2006
          • 802

          #5
          The file path should look like this in the query before inserting to MySQL
          Code:
          C:\\My Documents\\myFolder\\myFile
          To achieve this you can use Replace function.

          Comment

          Working...