Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. escape character

escape character

Scheduled Pinned Locked Moved Visual Basic
csharpdatabasehelp
11 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    balakpn
    wrote on last edited by
    #1

    hi i have to insert a string into database but while inserting it is not allowing me to insert as ther is some special characters and my main problem is string contains ( ' ) this character .i am in need of escape characters in vb.net thanks

    with regards Balagurunathan.B

    J D T 3 Replies Last reply
    0
    • B balakpn

      hi i have to insert a string into database but while inserting it is not allowing me to insert as ther is some special characters and my main problem is string contains ( ' ) this character .i am in need of escape characters in vb.net thanks

      with regards Balagurunathan.B

      J Offline
      J Offline
      Johan Hakkesteegt
      wrote on last edited by
      #2

      Hi, You can try Asc(27) or Char(Asc(27)) or Char("ESC"). Good luck, Johan

      My advice is free, and you may get what you paid for.

      B 2 Replies Last reply
      0
      • J Johan Hakkesteegt

        Hi, You can try Asc(27) or Char(Asc(27)) or Char("ESC"). Good luck, Johan

        My advice is free, and you may get what you paid for.

        B Offline
        B Offline
        balakpn
        wrote on last edited by
        #3

        HI SHOULD I HAVE TO REPLACE COMMAND I NEE THE ORIGINAL CONTENTS BACK WHILE RETRIVING IN C# WE USE \\ R @ CHAR WAT HAVE TO USE FOR THIS

        with regards Balagurunathan.B

        J 1 Reply Last reply
        0
        • J Johan Hakkesteegt

          Hi, You can try Asc(27) or Char(Asc(27)) or Char("ESC"). Good luck, Johan

          My advice is free, and you may get what you paid for.

          B Offline
          B Offline
          balakpn
          wrote on last edited by
          #4

          hi now i will say very clearly i want to insert a string into database for eg its a program and i am going to insert in a memo field the string contains many spl char the single quotes is my big problem( ' ) i want to use some escape char so i can save asit into databse and retrive the content simillar to original string insert in c# we use @ or \\ wat we will be using in vb.net

          with regards Balagurunathan.B

          1 Reply Last reply
          0
          • B balakpn

            HI SHOULD I HAVE TO REPLACE COMMAND I NEE THE ORIGINAL CONTENTS BACK WHILE RETRIVING IN C# WE USE \\ R @ CHAR WAT HAVE TO USE FOR THIS

            with regards Balagurunathan.B

            J Offline
            J Offline
            Johan Hakkesteegt
            wrote on last edited by
            #5

            Hi Balagurunathan, No need to shout, I can hear you just fine (please press your Caps Lock key). It seems that I did not quite understand you. You are not looking to identify the Escape character but the ' character. In VB.NET you can use the Replace method: YourString.Replace("'", "´") The first string is the string (or character) that you want to remove, and the second string is the string that you want to put in its place. If you only want to remove a certain string or character from a String you could try: YourString.Replace("'", "") Johan

            My advice is free, and you may get what you paid for.

            B 1 Reply Last reply
            0
            • J Johan Hakkesteegt

              Hi Balagurunathan, No need to shout, I can hear you just fine (please press your Caps Lock key). It seems that I did not quite understand you. You are not looking to identify the Escape character but the ' character. In VB.NET you can use the Replace method: YourString.Replace("'", "´") The first string is the string (or character) that you want to remove, and the second string is the string that you want to put in its place. If you only want to remove a certain string or character from a String you could try: YourString.Replace("'", "") Johan

              My advice is free, and you may get what you paid for.

              B Offline
              B Offline
              balakpn
              wrote on last edited by
              #6

              see i can use replace command for that but the thing is before storing i will concat the string by line by line as how the program will look so at that time i can replace it but while retriving it will be like a full program so now i am not able to replace its the problem so i am trying to use escape character

              with regards Balagurunathan.B

              J 1 Reply Last reply
              0
              • B balakpn

                see i can use replace command for that but the thing is before storing i will concat the string by line by line as how the program will look so at that time i can replace it but while retriving it will be like a full program so now i am not able to replace its the problem so i am trying to use escape character

                with regards Balagurunathan.B

                J Offline
                J Offline
                Johan Hakkesteegt
                wrote on last edited by
                #7

                Where are you retrieving the text from, a database, a file or a TextBox?

                My advice is free, and you may get what you paid for.

                B 1 Reply Last reply
                0
                • J Johan Hakkesteegt

                  Where are you retrieving the text from, a database, a file or a TextBox?

                  My advice is free, and you may get what you paid for.

                  B Offline
                  B Offline
                  balakpn
                  wrote on last edited by
                  #8

                  really its a program i am reading line by line i have to store some part of code into database so in some circumstance i will display those part to the endusers some times i have to retrive values from buffer and have to store in database and have to display it later to enduser for the purpose i need escape character which will store as it and so no need to replace again by searching and all

                  with regards Balagurunathan.B

                  J 1 Reply Last reply
                  0
                  • B balakpn

                    really its a program i am reading line by line i have to store some part of code into database so in some circumstance i will display those part to the endusers some times i have to retrive values from buffer and have to store in database and have to display it later to enduser for the purpose i need escape character which will store as it and so no need to replace again by searching and all

                    with regards Balagurunathan.B

                    J Offline
                    J Offline
                    Johan Hakkesteegt
                    wrote on last edited by
                    #9

                    Hi, I am sorry, I am trying to help you, but I am not sure what you mean. Are you trying to read VB.NET code programmatically, and then insert it into a database? Is the problem that the VB.NET code contains ' characters (comments in VB.NET)? Does you application need to show existing code to a user, allow the user to modify the code, and if he wants, let the user save the modified code into the database? In other words, the code may contain ' characters when you have to read it, and/or it may contain ' characters when you insert it (back) into a database? Please can you clarify? Johan

                    My advice is free, and you may get what you paid for.

                    1 Reply Last reply
                    0
                    • B balakpn

                      hi i have to insert a string into database but while inserting it is not allowing me to insert as ther is some special characters and my main problem is string contains ( ' ) this character .i am in need of escape characters in vb.net thanks

                      with regards Balagurunathan.B

                      D Offline
                      D Offline
                      Dave Kreskowiak
                      wrote on last edited by
                      #10

                      If you use a parameterized query, you don't have to worry about escaping this character yourself. The Parameter object will escape it, and many others, for you. Read up on parameterized queries in Colin's article here[^].

                      Dave Kreskowiak Microsoft MVP - Visual Basic

                      1 Reply Last reply
                      0
                      • B balakpn

                        hi i have to insert a string into database but while inserting it is not allowing me to insert as ther is some special characters and my main problem is string contains ( ' ) this character .i am in need of escape characters in vb.net thanks

                        with regards Balagurunathan.B

                        T Offline
                        T Offline
                        theScorp
                        wrote on last edited by
                        #11

                        Well as far as i understand, u need to replace (') by ?('') (two single quotes) before storing it into database. ('') is nothing but the escape sequence for (') in Database (not i \n Vb.net). I guess this will solve the problem.

                        "If our Mind can, the Program can !!"

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups