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. C#
  4. Datagridview displaying garbage characters

Datagridview displaying garbage characters

Scheduled Pinned Locked Moved C#
databasehelpquestion
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.
  • T Offline
    T Offline
    tkrn
    wrote on last edited by
    #1

    Open up note pad, hold the left control and press backspace. You will produce a rectangle box character which i am not sure if it has any function or not in the operating system but when i pull data from my database, these characters appear where i believe are to be carriage returns. is there a way to parse/seperate those garbage characters out while still leaving them in the database? If the data is bound to a richtextbox control, the text appears formated with carriage returns correctly im stuck...

    S 1 Reply Last reply
    0
    • T tkrn

      Open up note pad, hold the left control and press backspace. You will produce a rectangle box character which i am not sure if it has any function or not in the operating system but when i pull data from my database, these characters appear where i believe are to be carriage returns. is there a way to parse/seperate those garbage characters out while still leaving them in the database? If the data is bound to a richtextbox control, the text appears formated with carriage returns correctly im stuck...

      S Offline
      S Offline
      SomeGuyThatIsMe
      wrote on last edited by
      #2

      is it possible that the data is Unicode and you're treating it as normal ascii, or vise versa? i've accidently set varchar columns in the db to use nvarchar and it did some wierd things until i changed it back. they could also be special formatting characters that work in rich text, but a singleline textbox cant show them.

      Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      T 1 Reply Last reply
      0
      • S SomeGuyThatIsMe

        is it possible that the data is Unicode and you're treating it as normal ascii, or vise versa? i've accidently set varchar columns in the db to use nvarchar and it did some wierd things until i changed it back. they could also be special formatting characters that work in rich text, but a singleline textbox cant show them.

        Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

        T Offline
        T Offline
        tkrn
        wrote on last edited by
        #3

        The entire database, every table uses varchar not nvarchar. I've had issues in the past with nvarchar too plus it takes more space and computing power plus it is pretty much an all english environment thus no real need for nvarchar. i think you are right with the special formatting not working in a regular textbox/data grid view. I wonder if there is away around that though to ignore which ever charaters.

        S 1 Reply Last reply
        0
        • T tkrn

          The entire database, every table uses varchar not nvarchar. I've had issues in the past with nvarchar too plus it takes more space and computing power plus it is pretty much an all english environment thus no real need for nvarchar. i think you are right with the special formatting not working in a regular textbox/data grid view. I wonder if there is away around that though to ignore which ever charaters.

          S Offline
          S Offline
          SomeGuyThatIsMe
          wrote on last edited by
          #4

          you could use regular expressions to filter the output for testing(until you figure out whats wrong) and only allow certain characters or classes of characters and see what fixes your problem, it isnt a very good permanent solution but it should let you quickly see what is causing the problem and figure out a way to prevent it from bieng loaded into the db or find a way to quickly get rid of it. Ive found this useful[^]

          Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

          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