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. Web Development
  3. ASP.NET
  4. textbox validation please help

textbox validation please help

Scheduled Pinned Locked Moved ASP.NET
databasehelpannouncement
4 Posts 2 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.
  • D Offline
    D Offline
    dasumohan
    wrote on last edited by
    #1

    HI, I have some text in a textbox that is reading directly from a database. My application is supposed to allow user to update this text, so it directly affects in the database content. Now in my text there are some special characters like : , ' href < >. The code works fine as long as the text data in the text box does not contain these characters. As soon as it encounters data with these characters it does not update the database, any suggestions to tackle this. I already tried, in web.config with no success

    Raj D

    G 1 Reply Last reply
    0
    • D dasumohan

      HI, I have some text in a textbox that is reading directly from a database. My application is supposed to allow user to update this text, so it directly affects in the database content. Now in my text there are some special characters like : , ' href < >. The code works fine as long as the text data in the text box does not contain these characters. As soon as it encounters data with these characters it does not update the database, any suggestions to tackle this. I already tried, in web.config with no success

      Raj D

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      dasumohan wrote:

      As soon as it encounters data with these characters it does not update the database

      It would be helpful if you described exactly what is happening, not just what is not happening.

      --- single minded; short sighted; long gone;

      D 1 Reply Last reply
      0
      • G Guffa

        dasumohan wrote:

        As soon as it encounters data with these characters it does not update the database

        It would be helpful if you described exactly what is happening, not just what is not happening.

        --- single minded; short sighted; long gone;

        D Offline
        D Offline
        dasumohan
        wrote on last edited by
        #3

        Thanks for the response I have text box reading text content from database. When I change the text in the textbox and do update, it does not update in the database. I traced the problem to special characters like : and ' in the text field. When the text in the text field does not contain these special characters, it works fine. How to get around these special characters?

        Raj D

        G 1 Reply Last reply
        0
        • D dasumohan

          Thanks for the response I have text box reading text content from database. When I change the text in the textbox and do update, it does not update in the database. I traced the problem to special characters like : and ' in the text field. When the text in the text field does not contain these special characters, it works fine. How to get around these special characters?

          Raj D

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          You don't have to get around any characters, you just have to treat them properly. What do you do to update the database? What method are you using? Do you create an SQL query yourself? Do you use a parameterised query or do you concatenate the values into the query? I see no reason why a colon would be any problematic, but an apostrophe is a common problem if you concatenate strings into the query and don't encode the data properly first.

          --- single minded; short sighted; long gone;

          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